crustc: entirety of `rustc`, translated to C
Philpax
211 points
37 comments
July 02, 2026
Related Discussions
Found 5 related stories in 771.0ms across 14,015 title embeddings via pgvector HNSW
- The C to Rust migration book LukeMathWalker · 23 pts · July 01, 2026 · 57% similar
- Cpp2Rust: Translates C++ to safe Rust automatically signa11 · 47 pts · July 10, 2026 · 56% similar
- Rusternetes : A ground-up reimplementation of Kubernetes in Rust mariuz · 12 pts · April 29, 2026 · 55% similar
- An incoherent Rust emschwartz · 160 pts · March 23, 2026 · 53% similar
- CRusTTY: A pedagogical C interpreter with time-travel debugging capabilities varun_ch · 16 pts · March 11, 2026 · 52% similar
Discussion Highlights (18 comments)
Tiberium
I wonder how the performance looks like, because this can be interesting even for non-porting reasons ;)
ronsor
> I put my left hand in a blender. The blender won. (Still have all my fingers, just some stitches). I will not elaborate further. What a shame. I would've read an article about this.
Cadwhisker
> The primary goal of this is support for old/obscure hardware with no LLVM/GCC support. There are still some systems out there that don't support Rust but support C. The landing page mentions Plan 9 as one of the systems.
lioeters
> For the past 3 years, I have been working on compiling Rust to C. .. This is, by my count, the 14th attempt: cilly Gotta respect the dedication to a niche interest. > The primary goal of this is support for old/obscure hardware with no LLVM/GCC support. I remember reading about the bootstrapping question, how it typically requires a Rust compiler to build the Rust compiler from source. https://bootstrapping.miraheze.org/wiki/Bootstrapping_Specif... Oh, but I see there's a C++ implementation of the Rust compiler. https://github.com/thepowersgang/mrustc Anyway, this part sounds useful too, that crustc can compile across network and devices. > You build a small C server on your Blorbo OS, run rustc on some normal platform like Linux, and let cilly talk over the wire.
taris2
Have you tried Diverse Double-Compiling (DDC) to test if the official rust compiler has a backdoor? Use crustc to compile the rust source code, producing a new compiler. Then use this new compiler and the official rustc binary, both with deterministic flags, to compile the rust source code again. The two outputs should match bit for bit.
Imustaskforhelp
This could be used within https://bootstrappable.org/projects.html to make bootstrappability of rust incredibly much easier other than the previous route of OCaml and other things. I know some folks within the bootstrappable OS projects community are on Hackernews and I hope that they could take a look at this. I feel as if this project could drastically shrink down the efforts needed to get a working rust compiler in a bootstrappable manner.
levkk
Very cool. At first, I thought it was yet another LLM-generated demo, but no: original work of art. Super cool. Transpiling into C does seem easier than LLVM IR, and letting GCC optimize seems like this might actually work. Excited to see the compiler implementation when it's out -- a lot to learn from.
ahartmetz
Wait, I thought LLVM had a C backend which could be used for the purpose of transpiling Rust to C? Turns out not for a long time, but now maybe again: https://discourse.llvm.org/t/re-ann-llvm-c-backend-still-abl...
SpecialistK
I wonder if this could be used in PPC Mac OS X, where LLVM isn't supported and most graphical applications need to use GCC 4 with Apple's SDK.
layer8
Finally we can rewrite all the Rust in C. ;)
dangoodmanUT
i believe the author is confused this is the wrong direction (jk i read the readme)
groos
As an ex C++ compiler developer, I heartily approve of this project. Kudos.
nxtfari
this is really cool but it seems very unlikely that someone targeting an exotic system not supported by rust (mostly embedded and ancient mainframe targets) would be willing to trust a beta transpiler to not inject any bugs or leaks in the process of turning rust to c. nevertheless, very cool.
npalli
Rewrite in C is the new Rewrite in Rust.
linzhangrun
Quite an interesting project, lol. I like the name `crustc` :)
casey2
Not to be confused with crust [1] the dialect of rust B [2][3] is written in. [1] https://github.com/tsoding/crust [2] https://github.com/bext-lang/b [3] https://www.nokia.com/bell-labs/about/dennis-m-ritchie/kbman...
unjuno
The most interesting part of this to me is not “Rust to C” by itself, but the fact that it widens the pool of people who can help debug portability problems. There are relatively few people who understand Rust’s compiler internals, LLVM backends, and obscure target support deeply. But there are many engineers who understand C compilers, ABIs, linkers, makefiles, cross-compilation, old operating systems, and weird platform-specific compiler behavior. If Rust can be lowered into target-specific C, then some problems stop being exclusively “Rust compiler problems” and also become C toolchain problems. That means more people can inspect the generated C, build failures, linker errors, ABI mismatches, and compiler-specific behavior. C is obviously not a magic portability layer. ABI details, integer widths, alignment, TLS, aliasing, and undefined behavior still matter. But as an ecosystem boundary, C gives many more engineers a way to participate in debugging and porting work. I think that social/maintenance aspect may be more important than the language translation itself.
moezd
Let Rust vs C battle commence with renewed haste!