HeadlinesBriefing favicon HeadlinesBriefing.com

Rust compiler rebuilt in C demonstrates cross‑platform potential

Hacker News •
×

A GitHub repo named crustc showcases a full Rust compiler built from source code translated into plain C. The project converts rustc 1.98.0-nightly (c712ea946, June 16 2026) into roughly 46 million lines of C, which can be compiled with GCC and GNU make. The build requires the matching LLVM library (libLLVM.so.22.1‑rust‑1.98.0‑nightly).

The conversion is driven by cilly, a Rust‑to‑C backend that adapts generated code to the quirks of any target C compiler. It emits “witness” programs to probe support for thread‑local storage, type sizes, and alignment, then tailors the output to ANSI C constraints. This approach lets rustc run on platforms lacking native LLVM support, such as legacy or embedded systems.

The demo builds the compiler itself on an ARM64 Linux workstation, then compiles core, alloc, and std libraries without LLVM, proving end‑to‑end functionality. Build time hovers around 78 seconds on a 20‑core machine when optimizations are disabled. Although the author warns of stability issues and platform‑specific ABI mismatches, the proof‑of‑concept expands Rust’s reach to hardware previously unable to run it.

By keeping the output strictly ANSI C, crustc can be paired with any C compiler, even those accessed over TCP or serial links, enabling remote builds for exotic targets like Plan 9 or Z180. The author plans to open‑source the full toolchain once personal commitments clear, but the current repository already serves as a compelling benchmark for cross‑compilation strategies.