]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/atomic_ordering_ptr.rs
1 #![warn(clippy::invalid_atomic_ordering)]
3 use std
::sync
::atomic
::{AtomicPtr, Ordering}
;
7 let other_ptr
= &mut 10;
8 let x
= AtomicPtr
::new(ptr
);
10 // Allowed load ordering modes
11 let _
= x
.load(Ordering
::Acquire
);
12 let _
= x
.load(Ordering
::SeqCst
);
13 let _
= x
.load(Ordering
::Relaxed
);
15 // Disallowed load ordering modes
16 let _
= x
.load(Ordering
::Release
);
17 let _
= x
.load(Ordering
::AcqRel
);
19 // Allowed store ordering modes
20 x
.store(other_ptr
, Ordering
::Release
);
21 x
.store(other_ptr
, Ordering
::SeqCst
);
22 x
.store(other_ptr
, Ordering
::Relaxed
);
24 // Disallowed store ordering modes
25 x
.store(other_ptr
, Ordering
::Acquire
);
26 x
.store(other_ptr
, Ordering
::AcqRel
);