-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
remove panic docs for atomic load and stores #97590
remove panic docs for atomic load and stores #97590
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
r? @kennytm (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
rust/library/core/src/sync/atomic.rs Lines 2574 to 2575 in 0a43923
rust/library/core/src/sync/atomic.rs Lines 2588 to 2589 in 0a43923
|
Makes sense, that closes out this PR. I find it odd that the compiler gives you an error if you explicitly provide the wrong ordering as an Enum but not when the wrong ordering is provided as a variable. If I replace It would be nice to have the compiler catch that case too, but I see that |
Currently, the docs for loads and stores for Atomic types looks like this:
Load:
Store:
tl;dr, the docs indicate that storing with an ordering of
Acquire
orAcqRel
panics at runtime, and loading with an ordering ofRelease
orAcqRel
panics at runtime.This hasn't been true since 1.56 landed this patch, making it so incorrect orderings on loads and stores are compile time errors now.
#84039
A minimum example here:
On 1.55, the same program panics, indicating that the docs were correct at that point in time.