diff options
| author | Linus Färnstrand <faern@faern.net> | 2020-11-20 21:45:51 +0100 |
|---|---|---|
| committer | Linus Färnstrand <faern@faern.net> | 2020-12-22 12:17:43 +0100 |
| commit | 3abba5e21f362e325d52d922676ef26513a668e2 (patch) | |
| tree | 744d31894fdaf98e668e389c4fb5d4520d4873f0 | |
| parent | 793931f4220297f20116d61ac1a76c74b0fa3311 (diff) | |
| download | rust-3abba5e21f362e325d52d922676ef26513a668e2.tar.gz rust-3abba5e21f362e325d52d922676ef26513a668e2.zip | |
Deprecate compare_and_swap on all atomic types
| -rw-r--r-- | library/core/src/sync/atomic.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index a96da9aa6dc..8de7d53f302 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -479,6 +479,10 @@ impl AtomicBool { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_deprecated( + since = "1.50.0", + reason = "Use `compare_exchange` or `compare_exchange_weak` instead" + )] #[cfg(target_has_atomic = "8")] pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool { match self.compare_exchange(current, new, order, strongest_failure_ordering(order)) { @@ -1080,6 +1084,10 @@ impl<T> AtomicPtr<T> { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] + #[rustc_deprecated( + since = "1.50.0", + reason = "Use `compare_exchange` or `compare_exchange_weak` instead" + )] #[cfg(target_has_atomic = "ptr")] 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)) { @@ -1619,6 +1627,10 @@ assert_eq!(some_var.load(Ordering::Relaxed), 10); ```"), #[inline] #[$stable] + #[rustc_deprecated( + since = "1.50.0", + reason = "Use `compare_exchange` or `compare_exchange_weak` instead") + ] #[$cfg_cas] pub fn compare_and_swap(&self, current: $int_type, |
