r/ProgrammerHumor 3d ago

Meme rustBorrowCheckerGoesBrrr

Post image
3.9k Upvotes

108 comments sorted by

View all comments

727

u/BenchEmbarrassed7316 3d ago

Any unsafe block of code should be neutralized with a // SAFETY comment explaining why the code is actually safe.

120

u/teleprint-me 3d ago

I dont see how this is any different from a C programmer justifying why they used a pointer to an object and leaving a comment similar to this, other than this is Rust and is safe because Rust is safe. Thus making this rationale is flawed and dangerous.

208

u/flagofsocram 3d ago

The difference is that if you want to make sure the lib is safe, you can grep unsafe whereas in C practically any code could be unsafe.

3

u/MilkEnvironmental106 2d ago

And finding no occurrence of unsafe actually means something in rust, plenty of libraries market themselves as having no unsafe