The official compiler has an LLVM backend. GNU also wants to provide rust, and is adding a rust front to their gcc compiler.
These monthly reports document the progress until the gcc compiler reaches feature parity with the LLVM-based compiler
* Compiler docs: https://rustc-dev-guide.rust-lang.org/mir/optimizations.html
* Working Group: https://rust-lang.github.io/compiler-team/working-groups/mir...
* Example of one such optimization, "constant propagation" https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop...
GCC has an IR called GIMPLE that’s fine.
What is the second rust compiler?
"mrustc's primary goal is bootstrapping rustc, and as such it tends to assume that the code it's compiling is valid (and any errors in the generated code are mrustc bugs). Code generation is done by emitting a high-level assembly (currently very ugly C, but LLVM/cretone/GIMPLE/... could work) and getting an external tool (i.e. gcc) to do the heavy-lifting of optimising and machine code generation."
At least it can be used to bootstrap the actual rust compiler. It's a bit crazy to me how popular this language appears to be, but doesn't have a proper second compiler yet.
Certainly quite a bit of rustc could be cannibalized? Surely the parsing, type, and borrow checking stage or perhaps all the way to the m.i.r. could have been shared.
There is another project pursuing that approach. Both are valid strategies with different pros and cons.
On the practical level, rustc is written in rust and self-hosting, so reusing code from it in gcc would mean that you needed a rust compiler as well as a c compiler to compile gcc.
Also, rustc and gcc have incompatible licenses.
I see, they want a full Rust implementation written in C++ rather than in Rust?