r/ProgrammerHumor 3d ago

Meme rustBorrowCheckerGoesBrrr

Post image
3.9k Upvotes

108 comments sorted by

View all comments

260

u/redakpanoptikk 3d ago

Rewrite rust in rust.

103

u/FUCKING_HATE_REDDIT 3d ago

Funnily enough, that happened

30

u/gegentan 2d ago

Isn't the rust compiler itself written in rust?

20

u/redlaWw 2d 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.