As it stands, the way to bootstrap the official Rust compiler from source with just a C/C++ compiler is a few options:
* Compile OCaml (implemented in C), use it to build the original Rust front-end in OCaml and then build each successive version of the language until you hit 1.49. This option is not fun.
* Compile mrustc, which is a C++ implemented compiler that supports Rust 1.29. Use that to build the actual Rust 1.29 and then iterate building your way all the way to 1.49. That is less bad, but still not fun.
* Compile the 1.49 compiler to WASM and run it via a C/C++ implemented runtime in order to compile itself on the target system. This would also mean packaging and distributing the WASM generated code, which some distributions would refuse. I also am not sure if it's even currently feasible, as I don't follow the WASM situation closely.
A compliant, independent C++ implementation that could be built in the ten minutes it takes to build GCC itself would be a very good thing to have and would be more friendly to distribution maintainers.
Regardless, it was worth mentioning as a potential option. I am one of the handful of maintainers for an experimental distribution where packages are either compiled or interpreted from tarballs and this would be something we'd consider. I'd MUCH rather have the GCC front-end option, however. So far, we've simply not packaged Rust and have accepted that as dead-ending our Firefox package. This may potentially revive it.
How about memory safety and fearless concurrency?
Keeping a viable C++ implementation as part of GCC would be the smartest decision.
https://bootstrappable.org/ https://bootstrapping.miraheze.org/wiki/Main_Page
I know OpenBSD avoids rust because of the bootstrapping issue, but they also avoid LLVM because of a licensing issue.
Have you ever seen GCC crash with a SIGSEGV? I rarely did even when I used to be a GCC developer.
It might. There are at least two major things off the top of my head, regarding libstd:
1. specialization is needed for performance around String and &str
2. const generics are needed to support some trait implementations
We currently allow some stuff like this to leak through, in a sense, when we're sure that we're actually going to be making things stable someday. An alternative compiler could patch out 1, and accept slower code, but 2 would require way more effort.
There has been some discussion about trying to remove unstable features from the compiler itself, specifically to make it easier to contribute to, but it unlikely that it will be completely removed from the current implementation of libstd for some time.
> It's managed to build rustc from a source tarball, and use that rustc as stage0 for a full bootstrap pass. Even better, from my two full attempts, the resultant stage3 files have been binary identical to the same source archive built with the downloaded stage0.
There is also a port of the Ada frontend to LLVM backend: