Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ impl AtomicBool {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(any(stage0, target_has_atomic = "cas"))]
#[must_use = "if compare_and_swap does not return `current`, the stored value was not changed"]
pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool {
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
Ok(x) => x,
Expand Down Expand Up @@ -824,6 +825,7 @@ impl<T> AtomicPtr<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(any(stage0, target_has_atomic = "cas"))]
#[must_use = "if compare_and_swap does not return `current`, the stored value was not changed"]
pub fn compare_and_swap(&self, current: *mut T, new: *mut T, order: Ordering) -> *mut T {
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
Ok(x) => x,
Expand Down Expand Up @@ -1182,6 +1184,8 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
#[inline]
#[$stable]
#[cfg(any(stage0, target_has_atomic = "cas"))]
#[must_use = "if compare_and_swap does not return `current`, \
the stored value was not changed"]
pub fn compare_and_swap(&self,
current: $int_type,
new: $int_type,
Expand Down