static INVALID_ATOMIC_ORDERING: &LintExpand description
The invalid_atomic_ordering lint detects passing an Ordering
to an atomic operation that does not support that ordering.
§Example
let atom = AtomicU8::new(0);
let value = atom.load(Ordering::Release);{{produces}}
§Explanation
Some atomic operations are only supported for a subset of the
atomic::Ordering variants. Passing an unsupported variant will cause
an unconditional panic at runtime, which is detected by this lint.
This lint will trigger in the following cases: (where AtomicType is an
atomic type from core::sync::atomic, such as AtomicBool,
AtomicPtr, AtomicUsize, or any of the other integer atomics).
-
Passing
Ordering::AcquireorOrdering::AcqReltoAtomicType::store. -
Passing
Ordering::ReleaseorOrdering::AcqReltoAtomicType::load. -
Passing
Ordering::Relaxedtocore::sync::atomic::fenceorcore::sync::atomic::compiler_fence. -
Passing
Ordering::ReleaseorOrdering::AcqRelas the failure ordering for any ofAtomicType::compare_exchange,AtomicType::compare_exchange_weak, orAtomicType::fetch_update.