mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-24 20:13:24 +00:00
20 lines
534 B
Rust
20 lines
534 B
Rust
#![warn(clippy::invalid_atomic_ordering)]
|
|
|
|
use std::sync::atomic::{compiler_fence, fence, Ordering};
|
|
|
|
fn main() {
|
|
// Allowed fence ordering modes
|
|
fence(Ordering::Acquire);
|
|
fence(Ordering::Release);
|
|
fence(Ordering::AcqRel);
|
|
fence(Ordering::SeqCst);
|
|
|
|
// Disallowed fence ordering modes
|
|
fence(Ordering::Relaxed);
|
|
|
|
compiler_fence(Ordering::Acquire);
|
|
compiler_fence(Ordering::Release);
|
|
compiler_fence(Ordering::AcqRel);
|
|
compiler_fence(Ordering::SeqCst);
|
|
compiler_fence(Ordering::Relaxed);
|
|
}
|