crustc: The Entire rustc Compiler Translated to 46M Lines of C
A developer known as FractalFir has accomplished what sounds like a mad science experiment: they translated the entire rustc compiler (version 1.98.0-nightly, commit c712ea946, dated 2026-06-16) into 46 million lines of C. The result, called crustc, is a functional Rust compiler that can be built with GCC and GNU make. It can compile core, alloc, and std — the standard library — and is self-hosting in the sense that the C code was generated by the same toolchain.
This is not a toy. The generated C compiles to a working rustc binary that passes --version and can compile Rust programs. The project is a demo of a larger toolchain called cilly, which is a Rust library and compiler backend plugin that translates Rust to C. According to the author, this is the 14th attempt at such a tool.
How It Works
cilly adapts to the target C compiler by generating "witness" programs that probe the compiler's capabilities. For example:
/* This compiles if and only if our C compiler supports _Thread_local. */
_Thread_local int KEYWORD_TLS_SUPPORTED;
This allows cilly to generate C code that works with any C compiler, including obscure ones for niche platforms. The toolchain queries type layouts, sizes, alignments, character encodings, and integer formats, and falls back to reasonable assumptions with runtime assertions where necessary (e.g., CHAR_BIT == 8).
The output is compiler-specific — you cannot take C code generated for ARM64 and run it on RISC-V. But you can generate C specifically for RISC-V using the same Rust source. This approach targets systems without LLVM or GCC backends, such as Plan 9, Z80, or proprietary embedded platforms.
Building crustc
Building crustc requires a specific setup: GCC 13.3.0, LLVM 22.1 (from rustup nightly-2026-06-16), and GNU make. The build command:
make -j20 LLVM_LIB_DIR=~/.rustup/toolchains/nightly-2026-06-16-aarch64-unknown-linux-gnu/lib
On the author's ARM64 Linux machine, the build completes in about 1 minute 18 seconds (real time) with 1352% CPU utilization. Without optimizations, it takes ~938 seconds of user CPU time. The author warns that enabling optimizations can cause failures on certain large Rust files.
To test the build:
LD_LIBRARY_PATH=~/.rustup/toolchains/nightly-2026-06-16-aarch64-unknown-linux-gnu/lib:./rustc_driver ./rustc/rustc --version
This prints rustc 1.98.0-nightly (c712ea946 2026-06-16).
Networking and Cross-Compilation
One of cilly's standout features is network transparency. It can talk to C compilers over TCP (and potentially UART). This solves the bootstrap paradox: if your target platform (e.g., Plan 9) has no C cross-compiler, you can run rustc on a normal platform (Linux) and have cilly send C code over the wire to a small C server running on the target. The author successfully compiled a small Rust program for x86 Plan 9 from an ARM64 Linux machine.
term% echo `{cat /dev/sysname} osversion `{cat /dev/osversion} cputype $cputype
gnot osversion 2000 cputype 386
term% /tmp/hello_plan9
Hello, world!
ABI Compatibility
cilly-generated code is mostly ABI-compatible with normal rustc-compiled code. The exception is on ARM64, where rustc uses a struct return pointer (sret) that is passed in a different register than the first argument. This means the native C compiler must choose to return-by-sret for small structs (<16 bytes), which it often does not. This is a known limitation.
Current Status and Availability
crustc is a demo. The full cilly toolchain is not yet released. The author cites a job, university thesis, and a hand injury ("I put my left hand in a blender. The blender won.") as delays. They plan to release it "as soon as possible."
For now, you can build crustc from the GitHub repository, but be aware of bugs: crustc may crash when run in the directory it was built in, and building the standard library requires following BUILDING_STD.md.
Why This Matters
This project directly addresses a common criticism of Rust: lack of support for old or obscure hardware. If cilly matures, it could enable Rust on any platform with a C compiler, including embedded systems, legacy mainframes, and hobbyist OSes. It also demonstrates that Rust's rich type system and ownership model can survive translation to C, which is no small feat.
The 46 million lines of C are a testament to the complexity of rustc, but also to the power of compilation as a translation problem. If you've ever wished you could run Rust on your favorite retro computer, this is the most promising development yet.



