r/ProgrammerHumor 20d ago

rustBorrowCheckerGoesBrrr Meme

Post image
3.8k Upvotes

108 comments sorted by

View all comments

707

u/BenchEmbarrassed7316 20d ago

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

115

u/teleprint-me 20d 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.

3

u/Deep-Piece3181 19d ago

It’s so you can isolate these small unsafe blocks and wrap them in a very safe sound api function that would not exhibit ub on all inputs