-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clarify that unsafe code must not rely on our safe traits #115607
Merged
Merged
Conversation
This file contains 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
RalfJung
added
the
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
label
Sep 6, 2023
(rustbot has picked a reviewer for you, use r? to override) |
rustbot
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Sep 6, 2023
r? libs-api |
dtolnay
approved these changes
Sep 15, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@bors r+ rollup |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Sep 15, 2023
bors
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, 2023
Rollup 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a disclaimer to PartialEq, Eq, PartialOrd, Ord, Hash, Deref, DerefMut.
We already have a similar disclaimer in ExactSizeIterator (worded a bit differently):
If there are any other traits that should carry such a disclaimer, please let me know.
Fixes #73682