7/2/2026 at 11:48:39 PM
> For the past 3 years, I have been working on compiling Rust to C. .. This is, by my count, the 14th attempt: cillyGotta 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.
by lioeters
7/3/2026 at 12:51:22 AM
Guix uses mrustc for bootstrapping Rust, as required for compiler packages; it's a really impressive project and has worked well in that role for some time. This new project is interesting for other reasons though, because mrustc is targeted at the de fact "subset" of Rust in use by rustc at any given time. This looks like it could have broader applications, like compiling Rust programs for platforms not supported by LLVM. If it really targets ANSI C (C89 or so), that's potentially many more platforms than are possible with ordinary rustcMore on the Rust bootstrapping process (2018): https://guix.gnu.org/blog/2018/bootstrapping-rust/
by lispwitch
7/3/2026 at 4:49:56 PM
> compiling Rust programs for platforms not supported by LLVMFor this, gcc-rs[1][2] is the most promising candidate.
by xvilka
7/3/2026 at 10:09:52 PM
Gccrs is valuable for various reasons (bootstrapping, refining the spec, etc), but for the main purpose of "compiling to targets supported by gcc but not llvm", it's definitely not as promising as https://github.com/rust-lang/rustc_codegen_gcc. It's a rustc backend, at the same level as llvm or cranelift, it's much further along than gccrs (already available as a rustup component and can compile any rust code) and will not suffer from lagging behind rustc.But OP has wider ambitions: the real niche targets are supported by neither gcc nor llvm. A rust-to-c transpiler that can adapt to weird C compilers should have a very wide reach.
by moltonel
7/3/2026 at 5:49:51 PM
But what about platforms that even GCC doesn't support well? I'm thinking mostly retro stuff like 16-bit x86.by Narishma
7/3/2026 at 5:47:51 PM
I might have seen that Bootstrapping Rust article, how interesting. I've been curious about Guix for a while, one of these days I need to dive in and explore deeper. I really enjoyed their article on full-source bootstrap, it's relevant now more than ever.Building from Source All the Way Down - https://guix.gnu.org/en/blog/2023/the-full-source-bootstrap-...
by lioeters
7/3/2026 at 12:11:31 AM
So the author made a Rust to C transpiler and immediately used it to transpile... the Rust compiler. I love it.by zadikian
7/3/2026 at 5:52:25 AM
It makes sense as a porting tool, if you need to port the Rust compiler to some target that has a C compiler.But it doesn't mean rustc generates code for that target, only that you can run it there. You'd still have to teach LLVM about the target. Although that might already have been done.
It's not that useful for retro computers because the Rust compiler needs too much memory for most machines of the 32-bit era.
by Animats
7/3/2026 at 3:50:12 PM
As far as I know, ISO c++ is no better than microsoft rust.It is said microsoft rust syntax is on the same brain damage complexity level than ISO c++. That, and I don't even talk about the technical cost of its runtime (not far from the toxicity of a jvm?)
by sylware
7/3/2026 at 4:02:00 PM
What is Microsoft rust? I’ve never heard of such a thing. Or did I miss the joke?by slashdev
7/3/2026 at 4:23:19 PM
I don't think there's a joke, this commenter seems to believe Rust is controlled by Microsoftby hmry
7/3/2026 at 7:10:14 PM
Don't think I am alone to know that...by sylware
7/3/2026 at 12:35:14 PM
> The primary goal of this is support for old/obscure hardware with no LLVM/GCC support.If you're going to go to all this effort for an old target though, wouldn't the effort be better spent on making it an LLVM target? Then you'd get Rust and a bunch of other languages for free.
But maybe there are required parts of the LLVM IR that make this undesirable for certain targets, maybe requiring specific hardware features, I don't know. I guess also WASM-as-IR is a possible way to go. (Is that a thing?)
Edit: sorry I see that this point was already raised in this thread by ivanjermakov. Ignore.
by radarsat1
7/3/2026 at 5:44:06 PM
> WASM-as-IR .. (Is that a thing?)Yes, actually I've heard of some projects compiling a language to Wasm, then using wasm2c to translate to C.
https://github.com/WebAssembly/wabt/blob/main/wasm2c/README....
The Zig project does something similar for their bootstrapping process with a custom wasm2c implementation with just the features they need.
https://github.com/ziglang/zig/blob/master/stage1/wasm2c.c
I get the feeling this is an underappreciated technique with more potential.
by lioeters