-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #32365
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The impl looks okay to me. The comment regarding CAS loop also seems to be true, and LLVM won’t accept something like |
I'd be a little nervous to land this ahead of rust-lang/rfcs#1543 and rust-lang/rfcs#1505, but it seems fine to me in principle. I'm tagging with |
The libs team discussed this during triage yesterday, and some of our discussion led to some surprising conclusions, but in general we felt a little uncomfortable merging this ahead of rust-lang/rfcs#1543. In light of that, we're thinking that we may want to hold off on this for now until we move on one of those RFCs |
Ok, we discussed this again in light of accepting rust-lang/rfcs#1543, but we concluded that we probably don't want to do this at this time due to the uncertainty about what to do with platform-specific types. We can certainly revisit this though once the types become stable! |
I don't think platform-specific types are relevant here since any platform that supports pointer-sized atomics will always support byte-sized atomics. Changing the size of AtomicBool to 1 byte will therefore not introduce any compatibility issues. |
Add integer atomic types Tracking issue: #32976 RFC: rust-lang/rfcs#1543 The changes to AtomicBool in the RFC are not included, they are in a separate PR (#32365).
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
This allows
AtomicBool
to be transmuted to abool
, which makes it more consistent with the other atomic types. Note that this now guarantees that the atomic type will always contain a validbool
value, which wasn't the case before (due tofetch_nand
).