Skip to content

Commit 8cf86cd

Browse files
authored
Rollup merge of #138000 - RalfJung:atomic-rmw, r=Amanieu
atomic: clarify that failing conditional RMW operations are not 'writes' Fixes #136669 r? ``@Amanieu`` Cc ``@rust-lang/opsem`` ``@chorman0773`` ``@gnzlbg`` ``@briansmith``
2 parents 8cac259 + 1a5a453 commit 8cf86cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/core/src/sync/atomic.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
//! The most important aspect of this model is that *data races* are undefined behavior. A data race
4545
//! is defined as conflicting non-synchronized accesses where at least one of the accesses is
4646
//! non-atomic. Here, accesses are *conflicting* if they affect overlapping regions of memory and at
47-
//! least one of them is a write. They are *non-synchronized* if neither of them *happens-before*
48-
//! the other, according to the happens-before order of the memory model.
47+
//! least one of them is a write. (A `compare_exchange` or `compare_exchange_weak` that does not
48+
//! succeed is not considered a write.) They are *non-synchronized* if neither of them
49+
//! *happens-before* the other, according to the happens-before order of the memory model.
4950
//!
5051
//! The other possible cause of undefined behavior in the memory model are mixed-size accesses: Rust
5152
//! inherits the C++ limitation that non-synchronized conflicting atomic accesses may not partially

0 commit comments

Comments
 (0)