Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Zig is similar. Yes, they are going to replace LLVM by default, but they're not getting rid of their LLVM backend entirely.

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



> 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 Cranelift-based Rust compiler is perfectly capable of bootstrapping another Rust compiler (with some config changes) [2].

[0] https://github.com/bjorn3/rustc_codegen_cranelift

[1] https://github.com/rust-lang/rust/pull/77975

[2] https://github.com/bjorn3/rustc_codegen_cranelift/actions/ru...


So then why wasn't the initial response "Rust is self hostable"?

Perhaps there's something we're both missing here.


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: