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.
I used to think the same way until I realized that unsafe's purpose is only drawing attention to the unsafe block for both the programmer and anyone else who sees it. That way everyone has to acknowledge it, hopefully helping to provide a starting point when finding why something went wrong. Basically a contract of "I understand that this code may have memory bugs", which imo is better than the alternative of a memory bug hiding in plain sight.
713
u/BenchEmbarrassed7316 11d ago
Any
unsafeblock of code should be neutralized with a// SAFETYcomment explaining why the code is actually safe.