Key Takeaways

- The crustc project translates rustc 1.98.0-nightly into 46 million lines of C code that compiles with GCC and make
- The underlying cilly toolchain adapts to different C compilers by generating witness programs that probe platform capabilities
- Primary use case: bringing Rust to old or obscure hardware where LLVM and GCC Rust support don't exist
A developer known as FractalFir has released crustc, a version of the Rust compiler translated entirely into C. The result is 46 million lines of C code that builds with GCC and make, producing a working rustc 1.98.0-nightly binary. The compiler can build Rust's core, alloc, and std libraries. This is not a toy.
The project serves as a demo for FractalFir's broader work: cilly, a Rust-to-C compiler backend three years in the making. By the developer's count, this is the fourteenth attempt at the problem. Previous public experiments included rustc_codegen_clr. This one compiles.
How cilly adapts to C compilers
The core innovation in cilly is compiler adaptation. Rather than assuming a particular C standard or platform behavior, cilly generates "witness" programs. These small C snippets probe what a given compiler actually supports. Does it have _Thread_local? What's sizeof(float) versus sizeof(double)? Is the platform two's complement? ASCII? The tool queries everything.
This approach means cilly doesn't assume anything beyond ANSI C. It includes workarounds for modern C annoyances like strict aliasing rules. The tradeoff: output is compiler-specific. You can't take C generated for ARM64 and run it on RISC-V. But you can regenerate for RISC-V specifically.
The current crustc build targets ARM64 Linux because that's what FractalFir's workstation runs. It still requires LLVM's shared library (libLLVM.so) at runtime, since rustc uses LLVM as its code generation backend. The compiler itself is pure C, though.
Why build this at all?
The primary motivation is old and obscure hardware. Some systems have C compilers but no LLVM support and no GCC Rust frontend. Every time a project migrates from C to Rust, or a Rust alternative to a C tool emerges, someone legitimately points out that platform support shrinks. FractalFir wants to close that gap.
The tool also solves what compiler people call the bootstrap paradox. Normally you need a Rust compiler to compile the Rust compiler. With crustc, you need only C. That's a meaningful reduction in dependencies for getting Rust onto new platforms.
Network transparency for cross-compilation
Cilly has a feature that sounds strange until you think about it: network transparency. The tool can communicate with C compilers over TCP. FractalFir mentions it could be extended to UART if necessary.
The use case: platforms without C cross-compilers. You build a small C server on your target system, run rustc on a normal machine like Linux, and let cilly translate and compile over the network. FractalFir reports successfully compiling small Rust programs for x86 Plan9 VMs while running rustc on ARM64 Linux. The Plan9 output included proper Rust panic handling symbols.
ABI compatibility and limitations
Generated code is mostly ABI-compatible with normal rustc output. The qualifier exists because some platforms, including ARM64, have rustc choose ABIs that aren't representable from C. Linking cilly-compiled Rust with normally-compiled Rust will work in many cases, but not all.
Cilly can also generate makefiles. It embeds markers in object files and saves intermediate representation to a cache directory. It then reads those markers, splits functions and globals by definition location, and produces a directory structure with makefiles. This lets you build Rust using only make and a C compiler, no Rust toolchain required.
The 30x code expansion
The original rustc is roughly 1.5 million lines of Rust. The C translation is 46 million lines. That's about a 30x expansion, which isn't surprising. Rust's abstractions, generics, and ownership semantics compile down to verbose C. The output isn't meant to be human-readable. It's meant to compile.
The build FractalFir demonstrated used GCC 13.3.0 on Ubuntu. The resulting binary reports itself as rustc 1.98.0-nightly with the expected commit hash and date. It runs. It compiles Rust code. The technical achievement is real.
Logicity's Take
This project matters for anyone maintaining systems on older or niche hardware. If you're running embedded systems, legacy mainframes, or anything where LLVM doesn't reach, cilly could eventually let you write Rust instead of C. The practical question is whether the generated C compiles efficiently on your target's C compiler. A 46-million-line codebase will stress old or limited compilers. Watch for performance benchmarks comparing cilly-compiled Rust against native rustc output on mainstream platforms.
Frequently Asked Questions
Can crustc compile any Rust program?
In principle, yes. The demo shows it compiling rustc itself, core, alloc, and std. The limitation is that you still need LLVM's shared library at runtime for code generation.
Does crustc remove the need for LLVM entirely?
No. The generated C code produces a rustc binary that still uses LLVM as its backend. Crustc replaces how you build the compiler, not how the compiler generates code.
What C standard does cilly require?
Cilly tries to assume only ANSI C, probing platform capabilities with witness programs. It includes workarounds for modern C features like strict aliasing.
Can I use cilly for my own Rust projects?
The crustc repo is a demo of the compiler compiling itself. The full cilly toolchain reportedly can compile arbitrary Rust to C for arbitrary targets, but availability and documentation for general use wasn't detailed in the release.
Why is the C output 30 times larger than the Rust source?
Rust's abstractions, generics, and ownership checks expand significantly when lowered to C. The output is machine-generated for correctness, not readability or conciseness.
Need Help Implementing This?
If you're evaluating Rust adoption for legacy systems or need help with cross-compilation toolchains, reach out to our team at Logicity. We can help you assess whether cilly fits your platform requirements.
Source: Hacker News: Best
Manaal Khan
Tech & Innovation Writer
Produced with AI assistance and reviewed by the Logicity editorial team. Learn more in our Editorial Policy.
Related Articles
Browse all
AI Revolution: How Tech is Transforming the World, One Industry at a Time
From desalination plants in Iran to AI-powered manufacturing, the tech world is abuzz with innovation. Discover how AI is changing the game for small entrepreneurs and what it means for the future of industry. Explore the latest developments in cybersecurity, robotics, and more.

Revolutionizing AI: The Game-Changing Tech That's Making Agents Smarter
A new technology is set to revolutionize the way AI agents learn and adapt, enabling them to accumulate wisdom and apply it to new situations. This innovation has the potential to significantly boost the reliability of AI agents, especially in complex tasks. By converting raw agent trajectories into reusable guidelines, this tech is poised to transform the AI landscape.

The Dark Side of AI: How Bots Are Fueling a Monetized Abuse Ecosystem
A recent analysis of 2.8 million Telegram messages reveals a shocking truth: AI-powered bots are being used to create and sell non-consensual intimate images. These bots can turn ordinary photos into synthetic nude images, and the abuse is being monetized through affiliate programs and subscription-based archives. The researchers behind the study are calling for stricter regulations to combat this growing problem.

AI's Secret Sauce: How Journalism Became the Unlikely Ingredient
A recent study reveals that AI chatbots rely heavily on journalistic sources for their quotes, with one in four coming from news outlets. This shocking discovery has significant implications for the media industry and our understanding of AI's information gathering processes. As AI technology continues to evolve, it's essential to consider the role of journalism in shaping its responses.


