crustc: Entirety of rustc, translated to C

89 points by ajdecon


Melkor333

It can generate "witness" programs, which check what a given compiler and platform support:

I find it super weird that this is how the classical C configure build "chain" works in general. And it makes a lot of sense that this compiler (transpiler?!) adapts that pattern!

This is, by my count, the 14th attempt: cilly.

Well that's some dedication! I wish I had such persistence.

andrewrk

For comparison, I happen to have entirety of Zig compiler translated to C handy because it is part of how we routinely build from source.

It's 4.6 million lines, so almost exactly one order of magnitude smaller than this project. The generated C code is target specific (because comptime code can observe the target), but it is not compiler-specific.

nrvous

Maybe dumb question from someone who's not (at least not yet) a systems programmer – would a project like this hypothetically impact the choice to use Rust vs Zig? Since Zig's selling points include its support for a wide range of cross-compilation targets, and its self-hosted toolchain (with LLVM an optional dependency), this project's promised ability to compile Rust to obscure-platform-specific C seems like a bit of a shot across the bow.

Jan200101

This is cool, but isn't it still going to be limited by the capabilities of LLVM?