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 AtomicBool the same size as bool #33579

Merged
merged 1 commit into from
May 14, 2016
Merged

Conversation

Amanieu
Copy link
Member

@Amanieu Amanieu commented May 12, 2016

Reopening #32365

This allows AtomicBool to be transmuted to a bool, which makes it more consistent with the other atomic types. Note that this now guarantees that the atomic type will always contain a valid bool value, which wasn't the case before (due to fetch_nand).

r? @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+ 915fa57

Thanks!

@alexcrichton
Copy link
Member

Note that the libs team discussed this change during triage the other day and the conclusion was that we're amenable to this with the other recent changes to std::sync::atomic

@bors
Copy link
Contributor

bors commented May 14, 2016

⌛ Testing commit 915fa57 with merge 8492b6a...

bors added a commit that referenced this pull request May 14, 2016
Make AtomicBool the same size as bool

Reopening #32365

This allows `AtomicBool` to be transmuted to a `bool`, which makes it more consistent with the other atomic types. Note that this now guarantees that the atomic type will always contain a valid `bool` value, which wasn't the case before (due to `fetch_nand`).

r? @alexcrichton
@bors bors merged commit 915fa57 into rust-lang:master May 14, 2016
@strega-nil
Copy link
Contributor

strega-nil commented May 16, 2016

@Amanieu Is this a guarantee? Like, on all platforms, all compilers, AtomicBool can be transmuted to bool? Or just specific platforms?

@Amanieu
Copy link
Member Author

Amanieu commented May 16, 2016

As it is currently implemented, a transmute will work fine. However I am not sure whether we should make this guarantee to users. Note that currently, atomic-rs relies on AtomicU{8,16,32,64} being transmutable to & from their respective integer type.

@alexcrichton
Copy link
Member

When discussed with the libs team, the conclusion was that AtomicBool will not be able to be transmuted to bool, or rather it's not a guarantee that's provided.

@durka
Copy link
Contributor

durka commented May 18, 2016

This was a breaking change because people (edit: people such as @aturon) were previously transmuting usize to AtomicBool (see #33724).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants