mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-23 19:43:20 +00:00
21 lines
534 B
Rust
21 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);
|
||
|
}
|