Can Rust build itself without C++ compiler? When?

Can Rust build itself without C++ compiler? When?

The Rust compiler has been written in Rust for a couple years now.

Paradoxically, that means in order to build the compiler you already need an instance of the compiler on your machine. This is called the Bootstrapping Problem and is fairly common. Other languages like C/C++ and Go also need to deal with it, often by using a known-working version (what Rust and C/C++ do) or having a basic version of the compiler written in another language (Go).

1 Like

For now, Rust uses LLVM as a backend, so as LLVM is written in C++, the answer would be no. However, there is miri that can interpret MIR, so one could build Rust using that. Also there is work going on to add an alternative backend (Cretonne), which is written in Rust, so once that is finished, we could have a C++-less bootstrap. It would likely still be outperformed by the current LLVM version, but is still useful in thwarting trusting trust attacks.


we could have a C+±less bootstrap




...When they finally added en--dashes and em--dashes, I knew there had to be a catch---but I hadn't seen it until just now.

Uh, I'm sorry. Carry on.