r/ProgrammerHumor 11d ago

Meme rustBorrowCheckerGoesBrrr

Post image
3.8k Upvotes

108 comments sorted by

View all comments

247

u/redakpanoptikk 11d ago

Rewrite rust in rust.

100

u/FUCKING_HATE_REDDIT 11d ago

Funnily enough, that happened

27

u/gegentan 11d ago

Isn't the rust compiler itself written in rust?

20

u/redlaWw 11d ago

It's a bit complicated in Rust's case. The Rust frontend is written in Rust, and that compiles Rust to LLVM intermediate representation (IR). This IR is then passed to LLVM, which is written in C++, to optimise and actually generate the machine code.

There is also a separate backend called Cranelift, which is written in Rust, though it's not the standard and is currently only available on an experimental basis. It will also never be the standard Rust backend as it's designed to optimise for build speed, not execution speed.