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

Conversation

Projects
None yet
6 participants
@Amanieu
Copy link
Contributor

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

@Amanieu Amanieu force-pushed the Amanieu:atomic_bool2 branch 2 times, most recently from 4a69546 to 222b551 May 12, 2016

@Amanieu Amanieu force-pushed the Amanieu:atomic_bool2 branch from 222b551 to 915fa57 May 13, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented May 13, 2016

@bors: r+ 915fa57

Thanks!

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented May 13, 2016

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

This comment has been minimized.

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

Auto merge of #33579 - Amanieu:atomic_bool2, r=alexcrichton
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

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
homu Test successful
Details
@ubsan

This comment has been minimized.

Copy link
Contributor

ubsan 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

This comment has been minimized.

Copy link
Contributor 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

This comment has been minimized.

Copy link
Member

alexcrichton commented May 16, 2016

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

This comment has been minimized.

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
You can’t perform that action at this time.