Skip to content

Commit 0698922

Browse files
committed
Deprecate compare_and_swap on all atomic types
1 parent 593fe97 commit 0698922

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/core/src/sync/atomic.rs

Lines changed: 12 additions & 0 deletions
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)) {
@@ -1058,6 +1062,10 @@ impl<T> AtomicPtr<T> {
10581062
/// ```
10591063
#[inline]
10601064
#[stable(feature = "rust1", since = "1.0.0")]
1065+
#[rustc_deprecated(
1066+
since = "1.50.0",
1067+
reason = "Use `compare_exchange` or `compare_exchange_weak` instead"
1068+
)]
10611069
#[cfg(target_has_atomic = "ptr")]
10621070
pub fn compare_and_swap(&self, current: *mut T, new: *mut T, order: Ordering) -> *mut T {
10631071
match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) {
@@ -1582,6 +1590,10 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10);
15821590
```"),
15831591
#[inline]
15841592
#[$stable]
1593+
#[rustc_deprecated(
1594+
since = "1.50.0",
1595+
reason = "Use `compare_exchange` or `compare_exchange_weak` instead")
1596+
]
15851597
#[$cfg_cas]
15861598
pub fn compare_and_swap(&self,
15871599
current: $int_type,

0 commit comments

Comments
 (0)