diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-03-07 21:57:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-07 21:57:51 -0500 |
| commit | 8cf86cd68d5f3787f190933cac87e95d00618223 (patch) | |
| tree | 199f247dfadb703d00edf75d8e61f06c54be5496 | |
| parent | 8cac2593475edd203cf101d0236ff7bc17c38a9f (diff) | |
| parent | 1a5a4537437285bbd0f7f4cc9525b312a44789b2 (diff) | |
| download | rust-8cf86cd68d5f3787f190933cac87e95d00618223.tar.gz rust-8cf86cd68d5f3787f190933cac87e95d00618223.zip | |
Rollup merge of #138000 - RalfJung:atomic-rmw, r=Amanieu
atomic: clarify that failing conditional RMW operations are not 'writes' Fixes https://github.com/rust-lang/rust/issues/136669 r? ``@Amanieu`` Cc ``@rust-lang/opsem`` ``@chorman0773`` ``@gnzlbg`` ``@briansmith``
| -rw-r--r-- | library/core/src/sync/atomic.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index bac92ef94e7..ae28ec4baa0 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -44,8 +44,9 @@ //! The most important aspect of this model is that *data races* are undefined behavior. A data race //! is defined as conflicting non-synchronized accesses where at least one of the accesses is //! non-atomic. Here, accesses are *conflicting* if they affect overlapping regions of memory and at -//! least one of them is a write. They are *non-synchronized* if neither of them *happens-before* -//! the other, according to the happens-before order of the memory model. +//! least one of them is a write. (A `compare_exchange` or `compare_exchange_weak` that does not +//! succeed is not considered a write.) They are *non-synchronized* if neither of them +//! *happens-before* the other, according to the happens-before order of the memory model. //! //! The other possible cause of undefined behavior in the memory model are mixed-size accesses: Rust //! inherits the C++ limitation that non-synchronized conflicting atomic accesses may not partially |
