2
0
Fork 0
mirror of https://github.com/rust-lang/rust-clippy synced 2024-12-27 13:33:26 +00:00
rust-clippy/tests/ui/atomic_ordering_fence.rs
2020-01-09 09:51:42 -08:00

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);
}