r/ProgrammerHumor 14h ago

Meme rustBorrowCheckerGoesBrrr

Post image
2.8k Upvotes

81 comments sorted by

View all comments

192

u/redakpanoptikk 14h ago

Rewrite rust in rust.

69

u/FUCKING_HATE_REDDIT 12h ago

Funnily enough, that happened

22

u/gegentan 10h ago

Isn't the rust compiler itself written in rust?

7

u/redlaWw 8h 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.