rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.79k stars 261 forks source link

Clarify some of the language around marking traits safe/unsafe. #268

Closed yaymukund closed 3 years ago

yaymukund commented 3 years ago

Send and Sync are marked unsafe because thread safety is a fundamental property that unsafe code can't possibly hope to defend against in the way it could defend against a buggy Ord implementation.

When I initially read this, I thought it was strange you'd want to mark Send and Sync as unsafe if "unsafe code can't possibly hope to defend against [thread safety]".

Here, I've attempted to clarify.