clarify that unsafe code must not rely on our safe traits by RalfJung · Pull Request #115607 · rust-lang/rust
added
the
T-libs-api
label
Sep 6, 2023
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Sep 15, 2023bors added a commit to rust-lang-ci/rust that referenced this pull request
Sep 16, 2023…iaskrgr Rollup of 2 pull requests Successful merges: - rust-lang#115607 (clarify that unsafe code must not rely on our safe traits) - rust-lang#115866 (make interpreter and TyAndLayout type Debug impl independent of Ty debug impl) Failed merges: - rust-lang#115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty) - rust-lang#115884 (make ty::Const debug printing less verbose) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Sep 16, 2023Rollup merge of rust-lang#115607 - RalfJung:safe-traits-unsafe-code, r=dtolnay clarify that unsafe code must not rely on our safe traits This adds a disclaimer to PartialEq, Eq, PartialOrd, Ord, Hash, Deref, DerefMut. We already have a similar disclaimer in ExactSizeIterator (worded a bit differently): ``` /// Note that this trait is a safe trait and as such does *not* and *cannot* /// guarantee that the returned length is correct. This means that `unsafe` /// code **must not** rely on the correctness of [`Iterator::size_hint`]. The /// unstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives /// this additional guarantee. ``` If there are any other traits that should carry such a disclaimer, please let me know. Fixes rust-lang#73682
RalfJung
deleted the
safe-traits-unsafe-code
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters