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

Make Atomic*::from_mut return &mut Atomic* #92671

Merged
merged 1 commit into from
Jan 9, 2022

Conversation

WaffleLapkin
Copy link
Member

impl Atomic* {
    pub fn from_mut(v: &mut bool) -> &mut Self;
    //                               ^^^^---- previously was just a &
}

This PR makes from_mut atomic methods tracked in #76314 return unique references to atomic types, instead of shared ones. This makes from_mut and get_mut inverses of each other, allowing to undo either of them by the other.

r? @RalfJung
(as Ralf was concerned about this)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 8, 2022
@RalfJung
Copy link
Member

RalfJung commented Jan 8, 2022

I think this would make more sense, but it is inconsistent with Cell::from_mut.

And I don't think I can approve this. Cc @rust-lang/libs-api

@m-ou-se
Copy link
Member

m-ou-se commented Jan 8, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jan 8, 2022

📌 Commit 2b03ed1 has been approved by m-ou-se

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 8, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#92055 (Add release notes for 1.58)
 - rust-lang#92490 (Move crate drop-down to search results page)
 - rust-lang#92510 (Don't resolve blocks in foreign functions)
 - rust-lang#92573 (expand: Refactor InvocationCollector visitor for better code reuse)
 - rust-lang#92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes)
 - rust-lang#92657 (Implemented const casts of raw pointers)
 - rust-lang#92671 (Make `Atomic*::from_mut` return `&mut Atomic*`)
 - rust-lang#92673 (Remove useless collapse toggle on "all items" page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0871a38 into rust-lang:master Jan 9, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 9, 2022
@WaffleLapkin WaffleLapkin deleted the atomic_from_mut_unique_ref branch April 29, 2022 10:05
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants