3 ms·
As long as there isn't a Rust compiler written in Rust (there is a transpiler to LLVM bytecode, but that gets compiled by a C++ compiler, same for GCC-rs) I don
by tmtvl 4y ago
As long as there isn't a Rust compiler written in Rust (there is a transpiler to LLVM bytecode, but that gets compiled by a C++ compiler, same for GCC-rs) I don't think a C-free (or a C++-free) build will be possible at all, so I'm guessing it'll take somewhere in the 60-100 year range.
- ansible 4y agoThere are some open issues and features like inline assembly that aren't supported, but a moderately complete backend exists now: https://github.com/bjorn3/rustc_codegen_cranelift https://github.com/bjorn3/rustc_codegen_cranelift The compiler frontend is already written in Rust.
- estebank 4y agoHonest question: what would the engineering rationale be behind dropping LLVM entirely and have rustc have its own code generation backend? There are two out there that might be interesting, one uses gcc and another is called cranelift, but it isn't the default and focuses exclusively on compilation speed for debug binaries.
- tmtvl 4y agoWell people keep telling me that C/C++ code should be replaced by Rust for ~safety~ reasons, and LLVM is a C++ project, so... Let's say it would avoid all the memory bugs in LLVM, that would doubtlessly make it worth throwing away the LLVM implementation (avoid sunk cost fallacy).
- tialaramex 4y agoIf anything, it's more likely that the desirable choice is to shift LLVM to Rust.