top | item 27068832

(no title)

timidger | 4 years ago

Do you have a link to that discussion?

discuss

order

nicoburns|4 years ago

https://www.reddit.com/r/rust/comments/mxiufr/when_soundness...

I was one of the people who commented on that post. My point was basically that "you need to uphold invariants in order for this to be sound" is exactly what `unsafe` means in Rust. So if you're wrapping a library that doesn't guarantee safety then you should mark it as unsafe (and there's nothing wrong with that).

Rust library users will typically assume that they can do absolutely whatever they want with a safe interface and they cannot possibly cause memory safety issues, undefined behaviour, etc. A large part of the benefit of Rust is not even having to think about that. So it's important that libraries continue to stick to this convention.