Skip to content

Commit 3abba5e

Browse files
committed
Deprecate compare_and_swap on all atomic types
1 parent 793931f commit 3abba5e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/core/src/sync/atomic.rs

+12
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ impl AtomicBool {
479479
/// ```
480480
#[inline]
481481
#[stable(feature = "rust1", since = "1.0.0")]
482+
#[rustc_deprecated(
483+
since = "1.50.0",
484+
reason = "Use `compare_exchange` or `compare_exchange_weak` instead"
485+
)]
482486
#[cfg(target_has_atomic = "8")]
483487
pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool {
484488
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
@@ -1080,6 +1084,10 @@ impl<T> AtomicPtr<T> {
10801084
/// ```
10811085
#[inline]
10821086
#[stable(feature = "rust1", since = "1.0.0")]
1087+
#[rustc_deprecated(
1088+
since = "1.50.0",
1089+
reason = "Use `compare_exchange` or `compare_exchange_weak` instead"
1090+
)]
10831091
#[cfg(target_has_atomic = "ptr")]
10841092
pub fn compare_and_swap(&self, current: *mut T, new: *mut T, order: Ordering) -> *mut T {
10851093
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
@@ -1619,6 +1627,10 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
16191627
```"),
16201628
#[inline]
16211629
#[$stable]
1630+
#[rustc_deprecated(
1631+
since = "1.50.0",
1632+
reason = "Use `compare_exchange` or `compare_exchange_weak` instead")
1633+
]
16221634
#[$cfg_cas]
16231635
pub fn compare_and_swap(&self,
16241636
current: $int_type,

0 commit comments

Comments
 (0)