Skip to content
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

Change swap_nonoverlapping from lang to library UB #136890

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Feb 11, 2025

The implementation of ptr::swap_nonoverlapping does not always escalate its safety contract to language UB, so it should be check_library_ub.

Fixes rust-lang/miri#4188

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 11, 2025
@RalfJung
Copy link
Member

Implementation LGTM, but could you add a test?

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 12, 2025
@saethlin saethlin force-pushed the swap_nonoverlapping branch from 69f7f91 to 1a3e82d Compare February 12, 2025 16:01
@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2025

The Miri subtree was changed

cc @rust-lang/miri

@saethlin
Copy link
Member Author

Test added!

@RalfJung
Copy link
Member

Looks great, r=me when CI is green.

@rust-log-analyzer

This comment has been minimized.

@saethlin saethlin force-pushed the swap_nonoverlapping branch from 1a3e82d to 21bb8cb Compare February 12, 2025 17:20
@saethlin
Copy link
Member Author

@bors r=RalfJung rollup=always

@bors
Copy link
Contributor

bors commented Feb 12, 2025

📌 Commit 21bb8cb has been approved by RalfJung

It is now in the queue for this repository.

@bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 12, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2025
…llaumeGomez

Rollup of 10 pull requests

Successful merges:

 - rust-lang#136758 (tests: `-Copt-level=3` instead of `-O` in assembly tests)
 - rust-lang#136761 (tests: `-Copt-level=3` instead of `-O` in codegen tests)
 - rust-lang#136784 (Nuke `Buffer` abstraction from `librustdoc`, take 2 💣)
 - rust-lang#136838 (Check whole `Unsize` predicate for escaping bound vars)
 - rust-lang#136848 (add docs and ut for bootstrap util cache)
 - rust-lang#136871 (dev-guide: Link to `t-lang` procedures for new features)
 - rust-lang#136890 (Change swap_nonoverlapping from lang to library UB)
 - rust-lang#136901 (compiler: give `ExternAbi` truly stable `Hash` and `Ord`)
 - rust-lang#136907 (compiler: Make middle errors `pub(crate)` and bury the dead code)
 - rust-lang#136916 (use cc archiver as default in `cc2ar`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 269d784 into rust-lang:master Feb 12, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Feb 12, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2025
Rollup merge of rust-lang#136890 - saethlin:swap_nonoverlapping, r=RalfJung

Change swap_nonoverlapping from lang to library UB

The implementation of ptr::swap_nonoverlapping does not always escalate its safety contract to language UB, so it should be `check_library_ub`.

Fixes rust-lang/miri#4188
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 Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Miri does not catch UB when swap_nonoverlapping is used on the same ptr
5 participants