Re:A Guide to Undefined Behavior in C and C++
by LegionMammal978 on Thursday August 17, 2023 @06:36PM
(#37169148)
> When this happens, it seems like it'll be possible to get the LLVM bits out of the bootstrap process and lead to a fully self-hosted Rust.
What do you mean by "when this happens"? GP's point is that this has already happened: the Cranelift backend is feature-complete from the perspective of the language [0], except for inline assembly and unwinding on panic. It was merged into the upstream compiler in 2020 [1], and a compiler built with only the Cranelift backend is perfectly capable of building another compiler. LLVM hasn't been a necessary component of the Rust compiler for quite some time.
Re:A Guide to Undefined Behavior in C and C++
by merlincorey on Friday August 18, 2023 @03:04AM
(#37172222)
So then why wasn't the initial response "Rust is self hostable"?
Perhaps there's something we're both missing here.
Re:A Guide to Undefined Behavior in C and C++
by dralley on Friday August 18, 2023 @08:24AM
(#37174685)
I mean, it kinda was. It was the last sentence in the first post.
It wasn't my only response because
1) I couldn't remember if it had any significant limitations and couldn't be bothered to check
2) I still objected to the premise
In the article I linked, they did not say they were replacing LLVM by default, but they did say it would become the default for DEBUG builds due to the faster speed of compilation, to be clear.
> > Meanwhile, to truly understand Rust, one must be an expert in C and learn the `rustc` code base.
> Are you under the impression that the "rustc" codebase is written in C/C++? It is not... It uses LLVM, yes, but it's written in Rust.
I am not under that impression, but I can see how my phrasing leads to that conclusion.
After reviewing Rust's Bootstrap on Github[0] I can now more precisely state that one's understanding of low-level Rust will be enhanced by knowing C/C++ (for the LLVM portions) as well as Python (for the Rust does not exist on this system downloading of the stage0 binary Cargo and Rust compilers from somewhere else).
> Cranelift backend which is written in Rust
When this happens, it seems like it'll be possible to get the LLVM bits out of the bootstrap process and lead to a fully self-hosted Rust.
So while you may not personally value that, it seems like some people in the Rust community do.
[0] https://github.com/rust-lang/rust/tree/master/src/bootstrap