diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index ccf26ba4c2ac9..7fc5cf39ebeec 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -3181,7 +3181,7 @@ impl Weak { // Acquire is necessary for the success case to synchronise with `Arc::new_cyclic`, when the inner // value can be initialized after `Weak` references have already been created. In that case, we // expect to observe the fully initialized value. - if self.inner()?.strong.fetch_update(Acquire, Relaxed, checked_increment).is_ok() { + if self.inner()?.strong.try_update(Acquire, Relaxed, checked_increment).is_ok() { // SAFETY: pointer is not null, verified in checked_increment unsafe { Some(Arc::from_inner_in(self.ptr, self.alloc.clone())) } } else { diff --git a/library/core/src/alloc/global.rs b/library/core/src/alloc/global.rs index e2413b619f9fa..df141150ce95f 100644 --- a/library/core/src/alloc/global.rs +++ b/library/core/src/alloc/global.rs @@ -57,7 +57,7 @@ use crate::{cmp, ptr}; /// let mut allocated = 0; /// if self /// .remaining -/// .fetch_update(Relaxed, Relaxed, |mut remaining| { +/// .try_update(Relaxed, Relaxed, |mut remaining| { /// if size > remaining { /// return None; /// } diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index a3ceac89ef128..fdee9e84d992b 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -1274,72 +1274,26 @@ impl AtomicBool { self.v.get().cast() } - /// Fetches the value, and applies a function to it that returns an optional - /// new value. Returns a `Result` of `Ok(previous_value)` if the function - /// returned `Some(_)`, else `Err(previous_value)`. - /// - /// Note: This may call the function multiple times if the value has been - /// changed from other threads in the meantime, as long as the function - /// returns `Some(_)`, but the function will have been applied only once to - /// the stored value. - /// - /// `fetch_update` takes two [`Ordering`] arguments to describe the memory - /// ordering of this operation. The first describes the required ordering for - /// when the operation finally succeeds while the second describes the - /// required ordering for loads. These correspond to the success and failure - /// orderings of [`AtomicBool::compare_exchange`] respectively. - /// - /// Using [`Acquire`] as success ordering makes the store part of this - /// operation [`Relaxed`], and using [`Release`] makes the final successful - /// load [`Relaxed`]. The (failed) load ordering can only be [`SeqCst`], - /// [`Acquire`] or [`Relaxed`]. - /// - /// **Note:** This method is only available on platforms that support atomic - /// operations on `u8`. - /// - /// # Considerations - /// - /// This method is not magic; it is not provided by the hardware, and does not act like a - /// critical section or mutex. - /// - /// It is implemented on top of an atomic [compare-and-swap operation], and thus is subject to - /// the usual drawbacks of CAS operations. In particular, be careful of the [ABA problem]. - /// - /// [ABA Problem]: https://en.wikipedia.org/wiki/ABA_problem - /// [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap - /// - /// # Examples - /// - /// ```rust - /// use std::sync::atomic::{AtomicBool, Ordering}; - /// - /// let x = AtomicBool::new(false); - /// assert_eq!(x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |_| None), Err(false)); - /// assert_eq!(x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| Some(!x)), Ok(false)); - /// assert_eq!(x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| Some(!x)), Ok(true)); - /// assert_eq!(x.load(Ordering::SeqCst), false); - /// ``` + /// An alias for [`AtomicBool::try_update`]. #[inline] #[stable(feature = "atomic_fetch_update", since = "1.53.0")] #[cfg(target_has_atomic = "8")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces + #[deprecated( + since = "1.96.0", + note = "renamed to `try_update` for consistency", + suggestion = "try_update" + )] pub fn fetch_update( &self, set_order: Ordering, fetch_order: Ordering, - mut f: F, + f: F, ) -> Result where F: FnMut(bool) -> Option, { - let mut prev = self.load(fetch_order); - while let Some(next) = f(prev) { - match self.compare_exchange_weak(prev, next, set_order, fetch_order) { - x @ Ok(_) => return x, - Err(next_prev) => prev = next_prev, - } - } - Err(prev) + self.try_update(set_order, fetch_order, f) } /// Fetches the value, and applies a function to it that returns an optional @@ -1381,7 +1335,6 @@ impl AtomicBool { /// # Examples /// /// ```rust - /// #![feature(atomic_try_update)] /// use std::sync::atomic::{AtomicBool, Ordering}; /// /// let x = AtomicBool::new(false); @@ -1391,18 +1344,23 @@ impl AtomicBool { /// assert_eq!(x.load(Ordering::SeqCst), false); /// ``` #[inline] - #[unstable(feature = "atomic_try_update", issue = "135894")] + #[stable(feature = "atomic_try_update", since = "CURRENT_RUSTC_VERSION")] #[cfg(target_has_atomic = "8")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn try_update( &self, set_order: Ordering, fetch_order: Ordering, - f: impl FnMut(bool) -> Option, + mut f: impl FnMut(bool) -> Option, ) -> Result { - // FIXME(atomic_try_update): this is currently an unstable alias to `fetch_update`; - // when stabilizing, turn `fetch_update` into a deprecated alias to `try_update`. - self.fetch_update(set_order, fetch_order, f) + let mut prev = self.load(fetch_order); + while let Some(next) = f(prev) { + match self.compare_exchange_weak(prev, next, set_order, fetch_order) { + x @ Ok(_) => return x, + Err(next_prev) => prev = next_prev, + } + } + Err(prev) } /// Fetches the value, applies a function to it that it return a new value. @@ -1439,7 +1397,6 @@ impl AtomicBool { /// # Examples /// /// ```rust - /// #![feature(atomic_try_update)] /// /// use std::sync::atomic::{AtomicBool, Ordering}; /// @@ -1449,7 +1406,7 @@ impl AtomicBool { /// assert_eq!(x.load(Ordering::SeqCst), false); /// ``` #[inline] - #[unstable(feature = "atomic_try_update", issue = "135894")] + #[stable(feature = "atomic_try_update", since = "CURRENT_RUSTC_VERSION")] #[cfg(target_has_atomic = "8")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn update( @@ -1961,82 +1918,26 @@ impl AtomicPtr { unsafe { atomic_compare_exchange_weak(self.p.get(), current, new, success, failure) } } - /// Fetches the value, and applies a function to it that returns an optional - /// new value. Returns a `Result` of `Ok(previous_value)` if the function - /// returned `Some(_)`, else `Err(previous_value)`. - /// - /// Note: This may call the function multiple times if the value has been - /// changed from other threads in the meantime, as long as the function - /// returns `Some(_)`, but the function will have been applied only once to - /// the stored value. - /// - /// `fetch_update` takes two [`Ordering`] arguments to describe the memory - /// ordering of this operation. The first describes the required ordering for - /// when the operation finally succeeds while the second describes the - /// required ordering for loads. These correspond to the success and failure - /// orderings of [`AtomicPtr::compare_exchange`] respectively. - /// - /// Using [`Acquire`] as success ordering makes the store part of this - /// operation [`Relaxed`], and using [`Release`] makes the final successful - /// load [`Relaxed`]. The (failed) load ordering can only be [`SeqCst`], - /// [`Acquire`] or [`Relaxed`]. - /// - /// **Note:** This method is only available on platforms that support atomic - /// operations on pointers. - /// - /// # Considerations - /// - /// This method is not magic; it is not provided by the hardware, and does not act like a - /// critical section or mutex. - /// - /// It is implemented on top of an atomic [compare-and-swap operation], and thus is subject to - /// the usual drawbacks of CAS operations. In particular, be careful of the [ABA problem], - /// which is a particularly common pitfall for pointers! - /// - /// [ABA Problem]: https://en.wikipedia.org/wiki/ABA_problem - /// [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap - /// - /// # Examples - /// - /// ```rust - /// use std::sync::atomic::{AtomicPtr, Ordering}; - /// - /// let ptr: *mut _ = &mut 5; - /// let some_ptr = AtomicPtr::new(ptr); - /// - /// let new: *mut _ = &mut 10; - /// assert_eq!(some_ptr.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |_| None), Err(ptr)); - /// let result = some_ptr.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| { - /// if x == ptr { - /// Some(new) - /// } else { - /// None - /// } - /// }); - /// assert_eq!(result, Ok(ptr)); - /// assert_eq!(some_ptr.load(Ordering::SeqCst), new); - /// ``` + /// An alias for [`AtomicPtr::try_update`]. #[inline] #[stable(feature = "atomic_fetch_update", since = "1.53.0")] #[cfg(target_has_atomic = "ptr")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces + #[deprecated( + since = "1.96.0", + note = "renamed to `try_update` for consistency", + suggestion = "try_update" + )] pub fn fetch_update( &self, set_order: Ordering, fetch_order: Ordering, - mut f: F, + f: F, ) -> Result<*mut T, *mut T> where F: FnMut(*mut T) -> Option<*mut T>, { - let mut prev = self.load(fetch_order); - while let Some(next) = f(prev) { - match self.compare_exchange_weak(prev, next, set_order, fetch_order) { - x @ Ok(_) => return x, - Err(next_prev) => prev = next_prev, - } - } - Err(prev) + self.try_update(set_order, fetch_order, f) } /// Fetches the value, and applies a function to it that returns an optional /// new value. Returns a `Result` of `Ok(previous_value)` if the function @@ -2078,7 +1979,6 @@ impl AtomicPtr { /// # Examples /// /// ```rust - /// #![feature(atomic_try_update)] /// use std::sync::atomic::{AtomicPtr, Ordering}; /// /// let ptr: *mut _ = &mut 5; @@ -2097,18 +1997,23 @@ impl AtomicPtr { /// assert_eq!(some_ptr.load(Ordering::SeqCst), new); /// ``` #[inline] - #[unstable(feature = "atomic_try_update", issue = "135894")] + #[stable(feature = "atomic_try_update", since = "CURRENT_RUSTC_VERSION")] #[cfg(target_has_atomic = "ptr")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn try_update( &self, set_order: Ordering, fetch_order: Ordering, - f: impl FnMut(*mut T) -> Option<*mut T>, + mut f: impl FnMut(*mut T) -> Option<*mut T>, ) -> Result<*mut T, *mut T> { - // FIXME(atomic_try_update): this is currently an unstable alias to `fetch_update`; - // when stabilizing, turn `fetch_update` into a deprecated alias to `try_update`. - self.fetch_update(set_order, fetch_order, f) + let mut prev = self.load(fetch_order); + while let Some(next) = f(prev) { + match self.compare_exchange_weak(prev, next, set_order, fetch_order) { + x @ Ok(_) => return x, + Err(next_prev) => prev = next_prev, + } + } + Err(prev) } /// Fetches the value, applies a function to it that it return a new value. @@ -2147,7 +2052,6 @@ impl AtomicPtr { /// # Examples /// /// ```rust - /// #![feature(atomic_try_update)] /// /// use std::sync::atomic::{AtomicPtr, Ordering}; /// @@ -2160,7 +2064,7 @@ impl AtomicPtr { /// assert_eq!(some_ptr.load(Ordering::SeqCst), new); /// ``` #[inline] - #[unstable(feature = "atomic_try_update", issue = "135894")] + #[stable(feature = "atomic_try_update", since = "CURRENT_RUSTC_VERSION")] #[cfg(target_has_atomic = "8")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn update( @@ -3339,68 +3243,24 @@ macro_rules! atomic_int { unsafe { atomic_xor(self.v.get(), val, order) } } - /// Fetches the value, and applies a function to it that returns an optional - /// new value. Returns a `Result` of `Ok(previous_value)` if the function returned `Some(_)`, else - /// `Err(previous_value)`. - /// - /// Note: This may call the function multiple times if the value has been changed from other threads in - /// the meantime, as long as the function returns `Some(_)`, but the function will have been applied - /// only once to the stored value. - /// - /// `fetch_update` takes two [`Ordering`] arguments to describe the memory ordering of this operation. - /// The first describes the required ordering for when the operation finally succeeds while the second - /// describes the required ordering for loads. These correspond to the success and failure orderings of - #[doc = concat!("[`", stringify!($atomic_type), "::compare_exchange`]")] - /// respectively. - /// - /// Using [`Acquire`] as success ordering makes the store part - /// of this operation [`Relaxed`], and using [`Release`] makes the final successful load - /// [`Relaxed`]. The (failed) load ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]. - /// - /// **Note**: This method is only available on platforms that support atomic operations on - #[doc = concat!("[`", $s_int_type, "`].")] - /// - /// # Considerations - /// - /// This method is not magic; it is not provided by the hardware, and does not act like a - /// critical section or mutex. - /// - /// It is implemented on top of an atomic [compare-and-swap operation], and thus is subject to - /// the usual drawbacks of CAS operations. In particular, be careful of the [ABA problem] - /// if this atomic integer is an index or more generally if knowledge of only the *bitwise value* - /// of the atomic is not in and of itself sufficient to ensure any required preconditions. - /// - /// [ABA Problem]: https://en.wikipedia.org/wiki/ABA_problem - /// [compare-and-swap operation]: https://en.wikipedia.org/wiki/Compare-and-swap - /// - /// # Examples - /// - /// ```rust - #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] - /// - #[doc = concat!("let x = ", stringify!($atomic_type), "::new(7);")] - /// assert_eq!(x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |_| None), Err(7)); - /// assert_eq!(x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| Some(x + 1)), Ok(7)); - /// assert_eq!(x.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| Some(x + 1)), Ok(8)); - /// assert_eq!(x.load(Ordering::SeqCst), 9); - /// ``` + /// An alias for + #[doc = concat!("[`", stringify!($atomic_type), "::try_update`]")] + /// . #[inline] #[stable(feature = "no_more_cas", since = "1.45.0")] #[$cfg_cas] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces + #[deprecated( + since = "1.96.0", + note = "renamed to `try_update` for consistency", + suggestion = "try_update" + )] pub fn fetch_update(&self, set_order: Ordering, fetch_order: Ordering, - mut f: F) -> Result<$int_type, $int_type> + f: F) -> Result<$int_type, $int_type> where F: FnMut($int_type) -> Option<$int_type> { - let mut prev = self.load(fetch_order); - while let Some(next) = f(prev) { - match self.compare_exchange_weak(prev, next, set_order, fetch_order) { - x @ Ok(_) => return x, - Err(next_prev) => prev = next_prev - } - } - Err(prev) + self.try_update(set_order, fetch_order, f) } /// Fetches the value, and applies a function to it that returns an optional @@ -3442,7 +3302,6 @@ macro_rules! atomic_int { /// # Examples /// /// ```rust - /// #![feature(atomic_try_update)] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let x = ", stringify!($atomic_type), "::new(7);")] @@ -3452,18 +3311,23 @@ macro_rules! atomic_int { /// assert_eq!(x.load(Ordering::SeqCst), 9); /// ``` #[inline] - #[unstable(feature = "atomic_try_update", issue = "135894")] + #[stable(feature = "atomic_try_update", since = "CURRENT_RUSTC_VERSION")] #[$cfg_cas] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn try_update( &self, set_order: Ordering, fetch_order: Ordering, - f: impl FnMut($int_type) -> Option<$int_type>, + mut f: impl FnMut($int_type) -> Option<$int_type>, ) -> Result<$int_type, $int_type> { - // FIXME(atomic_try_update): this is currently an unstable alias to `fetch_update`; - // when stabilizing, turn `fetch_update` into a deprecated alias to `try_update`. - self.fetch_update(set_order, fetch_order, f) + let mut prev = self.load(fetch_order); + while let Some(next) = f(prev) { + match self.compare_exchange_weak(prev, next, set_order, fetch_order) { + x @ Ok(_) => return x, + Err(next_prev) => prev = next_prev + } + } + Err(prev) } /// Fetches the value, applies a function to it that it return a new value. @@ -3504,7 +3368,6 @@ macro_rules! atomic_int { /// # Examples /// /// ```rust - /// #![feature(atomic_try_update)] #[doc = concat!($extra_feature, "use std::sync::atomic::{", stringify!($atomic_type), ", Ordering};")] /// #[doc = concat!("let x = ", stringify!($atomic_type), "::new(7);")] @@ -3513,7 +3376,7 @@ macro_rules! atomic_int { /// assert_eq!(x.load(Ordering::SeqCst), 9); /// ``` #[inline] - #[unstable(feature = "atomic_try_update", issue = "135894")] + #[stable(feature = "atomic_try_update", since = "CURRENT_RUSTC_VERSION")] #[$cfg_cas] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn update( diff --git a/library/std/src/sys/sync/condvar/xous.rs b/library/std/src/sys/sync/condvar/xous.rs index 21a1587214a11..5d1b14443c62a 100644 --- a/library/std/src/sys/sync/condvar/xous.rs +++ b/library/std/src/sys/sync/condvar/xous.rs @@ -38,7 +38,7 @@ impl Condvar { // possible for `counter` to decrease due to a condvar timing out, in which // case the corresponding `timed_out` will increase accordingly. let Ok(waiter_count) = - self.counter.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |counter| { + self.counter.try_update(Ordering::Relaxed, Ordering::Relaxed, |counter| { if counter == 0 { return None; } else { diff --git a/library/std/src/sys/sync/rwlock/futex.rs b/library/std/src/sys/sync/rwlock/futex.rs index 961819cae8d6e..0e8e954de0758 100644 --- a/library/std/src/sys/sync/rwlock/futex.rs +++ b/library/std/src/sys/sync/rwlock/futex.rs @@ -86,7 +86,7 @@ impl RwLock { #[inline] pub fn try_read(&self) -> bool { self.state - .fetch_update(Acquire, Relaxed, |s| is_read_lockable(s).then(|| s + READ_LOCKED)) + .try_update(Acquire, Relaxed, |s| is_read_lockable(s).then(|| s + READ_LOCKED)) .is_ok() } @@ -164,7 +164,7 @@ impl RwLock { #[inline] pub fn try_write(&self) -> bool { self.state - .fetch_update(Acquire, Relaxed, |s| is_unlocked(s).then(|| s + WRITE_LOCKED)) + .try_update(Acquire, Relaxed, |s| is_unlocked(s).then(|| s + WRITE_LOCKED)) .is_ok() } diff --git a/library/std/src/sys/sync/rwlock/queue.rs b/library/std/src/sys/sync/rwlock/queue.rs index 62f084acfd259..b41a65f7303b2 100644 --- a/library/std/src/sys/sync/rwlock/queue.rs +++ b/library/std/src/sys/sync/rwlock/queue.rs @@ -329,7 +329,7 @@ impl RwLock { #[inline] pub fn try_read(&self) -> bool { - self.state.fetch_update(Acquire, Relaxed, read_lock).is_ok() + self.state.try_update(Acquire, Relaxed, read_lock).is_ok() } #[inline] @@ -343,7 +343,7 @@ impl RwLock { pub fn try_write(&self) -> bool { // Atomically set the `LOCKED` bit. This is lowered to a single atomic instruction on most // modern processors (e.g. "lock bts" on x86 and "ldseta" on modern AArch64), and therefore - // is more efficient than `fetch_update(lock(true))`, which can spuriously fail if a new + // is more efficient than `try_update(lock(true))`, which can spuriously fail if a new // node is appended to the queue. self.state.fetch_or(LOCKED, Acquire).addr() & LOCKED == 0 } @@ -453,7 +453,7 @@ impl RwLock { #[inline] pub unsafe fn read_unlock(&self) { - match self.state.fetch_update(Release, Acquire, |state| { + match self.state.try_update(Release, Acquire, |state| { if state.addr() & QUEUED == 0 { // If there are no threads queued, simply decrement the reader count. let count = state.addr() - (SINGLE | LOCKED); diff --git a/tests/ui/lint/lint-invalid-atomic-ordering-update.rs b/tests/ui/lint/lint-invalid-atomic-ordering-update.rs index ac41e7cee0c25..0cb87d4eab1b2 100644 --- a/tests/ui/lint/lint-invalid-atomic-ordering-update.rs +++ b/tests/ui/lint/lint-invalid-atomic-ordering-update.rs @@ -1,6 +1,4 @@ //@ only-x86_64 -#![feature(atomic_try_update)] - use std::sync::atomic::{AtomicIsize, Ordering}; fn main() { diff --git a/tests/ui/lint/lint-invalid-atomic-ordering-update.stderr b/tests/ui/lint/lint-invalid-atomic-ordering-update.stderr index 8c266bacf3144..5a5efbd85b0ac 100644 --- a/tests/ui/lint/lint-invalid-atomic-ordering-update.stderr +++ b/tests/ui/lint/lint-invalid-atomic-ordering-update.stderr @@ -1,5 +1,5 @@ error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:73:47 + --> $DIR/lint-invalid-atomic-ordering-update.rs:71:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -8,7 +8,7 @@ LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some( = note: `#[deny(invalid_atomic_ordering)]` on by default error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:75:45 + --> $DIR/lint-invalid-atomic-ordering-update.rs:73:45 | LL | let _ = x.try_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -16,7 +16,7 @@ LL | let _ = x.try_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(ol = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:77:41 + --> $DIR/lint-invalid-atomic-ordering-update.rs:75:41 | LL | let _ = x.update(Ordering::Relaxed, Ordering::AcqRel, |old| old + 1); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -24,7 +24,7 @@ LL | let _ = x.update(Ordering::Relaxed, Ordering::AcqRel, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:80:47 + --> $DIR/lint-invalid-atomic-ordering-update.rs:78:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -32,7 +32,7 @@ LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::AcqRel, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:82:45 + --> $DIR/lint-invalid-atomic-ordering-update.rs:80:45 | LL | let _ = x.try_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -40,7 +40,7 @@ LL | let _ = x.try_update(Ordering::Acquire, Ordering::AcqRel, |old| Some(ol = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:84:41 + --> $DIR/lint-invalid-atomic-ordering-update.rs:82:41 | LL | let _ = x.update(Ordering::Acquire, Ordering::AcqRel, |old| old + 1); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -48,7 +48,7 @@ LL | let _ = x.update(Ordering::Acquire, Ordering::AcqRel, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:87:47 + --> $DIR/lint-invalid-atomic-ordering-update.rs:85:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -56,7 +56,7 @@ LL | let _ = x.fetch_update(Ordering::Release, Ordering::AcqRel, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:89:45 + --> $DIR/lint-invalid-atomic-ordering-update.rs:87:45 | LL | let _ = x.try_update(Ordering::Release, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -64,7 +64,7 @@ LL | let _ = x.try_update(Ordering::Release, Ordering::AcqRel, |old| Some(ol = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:91:41 + --> $DIR/lint-invalid-atomic-ordering-update.rs:89:41 | LL | let _ = x.update(Ordering::Release, Ordering::AcqRel, |old| old + 1); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -72,7 +72,7 @@ LL | let _ = x.update(Ordering::Release, Ordering::AcqRel, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:94:46 + --> $DIR/lint-invalid-atomic-ordering-update.rs:92:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -80,7 +80,7 @@ LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:96:44 + --> $DIR/lint-invalid-atomic-ordering-update.rs:94:44 | LL | let _ = x.try_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -88,7 +88,7 @@ LL | let _ = x.try_update(Ordering::AcqRel, Ordering::AcqRel, |old| Some(old = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:98:40 + --> $DIR/lint-invalid-atomic-ordering-update.rs:96:40 | LL | let _ = x.update(Ordering::AcqRel, Ordering::AcqRel, |old| old + 1); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -96,7 +96,7 @@ LL | let _ = x.update(Ordering::AcqRel, Ordering::AcqRel, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:101:46 + --> $DIR/lint-invalid-atomic-ordering-update.rs:99:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -104,7 +104,7 @@ LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:103:44 + --> $DIR/lint-invalid-atomic-ordering-update.rs:101:44 | LL | let _ = x.try_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -112,7 +112,7 @@ LL | let _ = x.try_update(Ordering::SeqCst, Ordering::AcqRel, |old| Some(old = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:105:40 + --> $DIR/lint-invalid-atomic-ordering-update.rs:103:40 | LL | let _ = x.update(Ordering::SeqCst, Ordering::AcqRel, |old| old + 1); | ^^^^^^^^^^^^^^^^ invalid failure ordering @@ -120,7 +120,7 @@ LL | let _ = x.update(Ordering::SeqCst, Ordering::AcqRel, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:110:47 + --> $DIR/lint-invalid-atomic-ordering-update.rs:108:47 | LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -128,7 +128,7 @@ LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::Release, |old| Some = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:112:45 + --> $DIR/lint-invalid-atomic-ordering-update.rs:110:45 | LL | let _ = x.try_update(Ordering::Relaxed, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -136,7 +136,7 @@ LL | let _ = x.try_update(Ordering::Relaxed, Ordering::Release, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:114:41 + --> $DIR/lint-invalid-atomic-ordering-update.rs:112:41 | LL | let _ = x.update(Ordering::Relaxed, Ordering::Release, |old| old + 1); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -144,7 +144,7 @@ LL | let _ = x.update(Ordering::Relaxed, Ordering::Release, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:117:47 + --> $DIR/lint-invalid-atomic-ordering-update.rs:115:47 | LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -152,7 +152,7 @@ LL | let _ = x.fetch_update(Ordering::Acquire, Ordering::Release, |old| Some = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:119:45 + --> $DIR/lint-invalid-atomic-ordering-update.rs:117:45 | LL | let _ = x.try_update(Ordering::Acquire, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -160,7 +160,7 @@ LL | let _ = x.try_update(Ordering::Acquire, Ordering::Release, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:121:41 + --> $DIR/lint-invalid-atomic-ordering-update.rs:119:41 | LL | let _ = x.update(Ordering::Acquire, Ordering::Release, |old| old + 1); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -168,7 +168,7 @@ LL | let _ = x.update(Ordering::Acquire, Ordering::Release, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:124:47 + --> $DIR/lint-invalid-atomic-ordering-update.rs:122:47 | LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -176,7 +176,7 @@ LL | let _ = x.fetch_update(Ordering::Release, Ordering::Release, |old| Some = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:126:45 + --> $DIR/lint-invalid-atomic-ordering-update.rs:124:45 | LL | let _ = x.try_update(Ordering::Release, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -184,7 +184,7 @@ LL | let _ = x.try_update(Ordering::Release, Ordering::Release, |old| Some(o = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:128:41 + --> $DIR/lint-invalid-atomic-ordering-update.rs:126:41 | LL | let _ = x.update(Ordering::Release, Ordering::Release, |old| old + 1); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -192,7 +192,7 @@ LL | let _ = x.update(Ordering::Release, Ordering::Release, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:131:46 + --> $DIR/lint-invalid-atomic-ordering-update.rs:129:46 | LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -200,7 +200,7 @@ LL | let _ = x.fetch_update(Ordering::AcqRel, Ordering::Release, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:133:44 + --> $DIR/lint-invalid-atomic-ordering-update.rs:131:44 | LL | let _ = x.try_update(Ordering::AcqRel, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -208,7 +208,7 @@ LL | let _ = x.try_update(Ordering::AcqRel, Ordering::Release, |old| Some(ol = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:135:40 + --> $DIR/lint-invalid-atomic-ordering-update.rs:133:40 | LL | let _ = x.update(Ordering::AcqRel, Ordering::Release, |old| old + 1); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -216,7 +216,7 @@ LL | let _ = x.update(Ordering::AcqRel, Ordering::Release, |old| old + 1); = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:138:46 + --> $DIR/lint-invalid-atomic-ordering-update.rs:136:46 | LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -224,7 +224,7 @@ LL | let _ = x.fetch_update(Ordering::SeqCst, Ordering::Release, |old| Some( = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `try_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `try_update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:140:44 + --> $DIR/lint-invalid-atomic-ordering-update.rs:138:44 | LL | let _ = x.try_update(Ordering::SeqCst, Ordering::Release, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^^ invalid failure ordering @@ -232,7 +232,7 @@ LL | let _ = x.try_update(Ordering::SeqCst, Ordering::Release, |old| Some(ol = help: consider using `Acquire` or `Relaxed` failure ordering instead error: `update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `update` does not result in a write - --> $DIR/lint-invalid-atomic-ordering-update.rs:142:40 + --> $DIR/lint-invalid-atomic-ordering-update.rs:140:40 | LL | let _ = x.update(Ordering::SeqCst, Ordering::Release, |old| old + 1); | ^^^^^^^^^^^^^^^^^ invalid failure ordering