mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
Split test cases into separate files
This commit is contained in:
parent
9e6a6069a7
commit
18060eb81e
@ -1,196 +0,0 @@
|
||||
#![warn(clippy::invalid_atomic_ordering)]
|
||||
|
||||
use std::sync::atomic::{
|
||||
AtomicBool, AtomicI16, AtomicI32, AtomicI64, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16, AtomicU32, AtomicU64,
|
||||
AtomicU8, AtomicUsize, Ordering,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
// `AtomicBool` test cases
|
||||
let x = AtomicBool::new(true);
|
||||
|
||||
// Allowed load ordering modes
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
|
||||
// Disallowed load ordering modes
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
// Allowed store ordering modes
|
||||
x.store(false, Ordering::Release);
|
||||
x.store(false, Ordering::SeqCst);
|
||||
x.store(false, Ordering::Relaxed);
|
||||
|
||||
// Disallowed store ordering modes
|
||||
x.store(false, Ordering::Acquire);
|
||||
x.store(false, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI8` test cases
|
||||
let x = AtomicI8::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI16` test cases
|
||||
let x = AtomicI16::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI32` test cases
|
||||
let x = AtomicI32::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI64` test cases
|
||||
let x = AtomicI64::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicIsize` test cases
|
||||
let x = AtomicIsize::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicPtr` test cases
|
||||
let ptr = &mut 5;
|
||||
let other_ptr = &mut 10;
|
||||
let x = AtomicPtr::new(ptr);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(other_ptr, Ordering::Release);
|
||||
x.store(other_ptr, Ordering::SeqCst);
|
||||
x.store(other_ptr, Ordering::Relaxed);
|
||||
x.store(other_ptr, Ordering::Acquire);
|
||||
x.store(other_ptr, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU8` test cases
|
||||
let x = AtomicU8::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU16` test cases
|
||||
let x = AtomicU16::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU32` test cases
|
||||
let x = AtomicU32::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU64` test cases
|
||||
let x = AtomicU64::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicUsize` test cases
|
||||
let x = AtomicUsize::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
}
|
@ -1,387 +0,0 @@
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:18:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings`
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:19:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:27:20
|
||||
|
|
||||
LL | x.store(false, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:28:20
|
||||
|
|
||||
LL | x.store(false, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:36:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:37:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:42:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:43:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:51:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:52:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:57:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:58:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:66:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:67:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:72:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:73:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:81:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:82:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:87:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:88:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:96:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:97:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:102:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:103:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:113:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:114:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:119:24
|
||||
|
|
||||
LL | x.store(other_ptr, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:120:24
|
||||
|
|
||||
LL | x.store(other_ptr, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:128:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:129:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:134:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:135:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:143:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:144:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:149:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:150:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:158:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:159:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:164:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:165:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:173:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:174:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:179:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:180:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:188:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:189:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:194:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering.rs:195:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: aborting due to 48 previous errors
|
||||
|
25
tests/ui/atomic_ordering_bool.rs
Normal file
25
tests/ui/atomic_ordering_bool.rs
Normal file
@ -0,0 +1,25 @@
|
||||
#![warn(clippy::invalid_atomic_ordering)]
|
||||
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
fn main() {
|
||||
let x = AtomicBool::new(true);
|
||||
|
||||
// Allowed load ordering modes
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
|
||||
// Disallowed load ordering modes
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
// Allowed store ordering modes
|
||||
x.store(false, Ordering::Release);
|
||||
x.store(false, Ordering::SeqCst);
|
||||
x.store(false, Ordering::Relaxed);
|
||||
|
||||
// Disallowed store ordering modes
|
||||
x.store(false, Ordering::Acquire);
|
||||
x.store(false, Ordering::AcqRel);
|
||||
}
|
35
tests/ui/atomic_ordering_bool.stderr
Normal file
35
tests/ui/atomic_ordering_bool.stderr
Normal file
@ -0,0 +1,35 @@
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_bool.rs:14:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings`
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_bool.rs:15:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_bool.rs:23:20
|
||||
|
|
||||
LL | x.store(false, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_bool.rs:24:20
|
||||
|
|
||||
LL | x.store(false, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
86
tests/ui/atomic_ordering_int.rs
Normal file
86
tests/ui/atomic_ordering_int.rs
Normal file
@ -0,0 +1,86 @@
|
||||
#![warn(clippy::invalid_atomic_ordering)]
|
||||
|
||||
use std::sync::atomic::{AtomicI16, AtomicI32, AtomicI64, AtomicI8, AtomicIsize, Ordering};
|
||||
|
||||
fn main() {
|
||||
// `AtomicI8` test cases
|
||||
let x = AtomicI8::new(0);
|
||||
|
||||
// Allowed load ordering modes
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
|
||||
// Disallowed load ordering modes
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
// Allowed store ordering modes
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
|
||||
// Disallowed store ordering modes
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI16` test cases
|
||||
let x = AtomicI16::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI32` test cases
|
||||
let x = AtomicI32::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicI64` test cases
|
||||
let x = AtomicI64::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicIsize` test cases
|
||||
let x = AtomicIsize::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
}
|
163
tests/ui/atomic_ordering_int.stderr
Normal file
163
tests/ui/atomic_ordering_int.stderr
Normal file
@ -0,0 +1,163 @@
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:15:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings`
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:16:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:24:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:25:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:33:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:34:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:39:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:40:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:48:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:49:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:54:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:55:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:63:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:64:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:69:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:70:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:78:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:79:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:84:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_int.rs:85:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
|
27
tests/ui/atomic_ordering_ptr.rs
Normal file
27
tests/ui/atomic_ordering_ptr.rs
Normal file
@ -0,0 +1,27 @@
|
||||
#![warn(clippy::invalid_atomic_ordering)]
|
||||
|
||||
use std::sync::atomic::{AtomicPtr, Ordering};
|
||||
|
||||
fn main() {
|
||||
let ptr = &mut 5;
|
||||
let other_ptr = &mut 10;
|
||||
let x = AtomicPtr::new(ptr);
|
||||
|
||||
// Allowed load ordering modes
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
|
||||
// Disallowed load ordering modes
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
// Allowed store ordering modes
|
||||
x.store(other_ptr, Ordering::Release);
|
||||
x.store(other_ptr, Ordering::SeqCst);
|
||||
x.store(other_ptr, Ordering::Relaxed);
|
||||
|
||||
// Disallowed store ordering modes
|
||||
x.store(other_ptr, Ordering::Acquire);
|
||||
x.store(other_ptr, Ordering::AcqRel);
|
||||
}
|
35
tests/ui/atomic_ordering_ptr.stderr
Normal file
35
tests/ui/atomic_ordering_ptr.stderr
Normal file
@ -0,0 +1,35 @@
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_ptr.rs:16:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings`
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_ptr.rs:17:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_ptr.rs:25:24
|
||||
|
|
||||
LL | x.store(other_ptr, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_ptr.rs:26:24
|
||||
|
|
||||
LL | x.store(other_ptr, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
86
tests/ui/atomic_ordering_uint.rs
Normal file
86
tests/ui/atomic_ordering_uint.rs
Normal file
@ -0,0 +1,86 @@
|
||||
#![warn(clippy::invalid_atomic_ordering)]
|
||||
|
||||
use std::sync::atomic::{AtomicU16, AtomicU32, AtomicU64, AtomicU8, AtomicUsize, Ordering};
|
||||
|
||||
fn main() {
|
||||
// `AtomicU8` test cases
|
||||
let x = AtomicU8::new(0);
|
||||
|
||||
// Allowed load ordering modes
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
|
||||
// Disallowed load ordering modes
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
// Allowed store ordering modes
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
|
||||
// Disallowed store ordering modes
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU16` test cases
|
||||
let x = AtomicU16::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU32` test cases
|
||||
let x = AtomicU32::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicU64` test cases
|
||||
let x = AtomicU64::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
|
||||
// `AtomicUsize` test cases
|
||||
let x = AtomicUsize::new(0);
|
||||
|
||||
let _ = x.load(Ordering::Acquire);
|
||||
let _ = x.load(Ordering::SeqCst);
|
||||
let _ = x.load(Ordering::Relaxed);
|
||||
let _ = x.load(Ordering::Release);
|
||||
let _ = x.load(Ordering::AcqRel);
|
||||
|
||||
x.store(1, Ordering::Release);
|
||||
x.store(1, Ordering::SeqCst);
|
||||
x.store(1, Ordering::Relaxed);
|
||||
x.store(1, Ordering::Acquire);
|
||||
x.store(1, Ordering::AcqRel);
|
||||
}
|
163
tests/ui/atomic_ordering_uint.stderr
Normal file
163
tests/ui/atomic_ordering_uint.stderr
Normal file
@ -0,0 +1,163 @@
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:15:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::invalid-atomic-ordering` implied by `-D warnings`
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:16:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:24:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:25:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:33:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:34:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:39:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:40:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:48:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:49:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:54:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:55:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:63:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:64:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:69:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:70:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:78:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::Release);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic loads cannot have `Release` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:79:20
|
||||
|
|
||||
LL | let _ = x.load(Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:84:16
|
||||
|
|
||||
LL | x.store(1, Ordering::Acquire);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: atomic stores cannot have `Acquire` and `AcqRel` ordering
|
||||
--> $DIR/atomic_ordering_uint.rs:85:16
|
||||
|
|
||||
LL | x.store(1, Ordering::AcqRel);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: consider using ordering modes `Release`, `SeqCst` or `Relaxed`
|
||||
|
||||
error: aborting due to 20 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user