diff options
| author | Ralf Jung <post@ralfj.de> | 2019-12-24 12:24:32 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-12-24 12:24:32 +0100 |
| commit | 072676023ee1ca5f69d071f85995c929e091eb52 (patch) | |
| tree | 0fad7513c47d4f13eaa66db9e9483e2473d2b4a8 /src/test | |
| parent | db20f248ebcd2a6cb5230b3bde7f400a380b0b87 (diff) | |
better variable names
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/const_refers_to_static.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr | 24 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs index 55f3f1c8488..e07db3ffba2 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs @@ -6,31 +6,31 @@ use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; -const BOO: &usize = { //~ ERROR undefined behavior to use this value +const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value static FOO: AtomicUsize = AtomicUsize::new(0); unsafe { &*(&FOO as *const _ as *const usize) } //~^ WARN skipping const checks }; -const FOO: usize = { +const MUTATE_INTERIOR_MUT: usize = { static FOO: AtomicUsize = AtomicUsize::new(0); FOO.fetch_add(1, Ordering::Relaxed) //~ WARN any use of this value will cause an error //~^ WARN skipping const checks //~| WARN skipping const checks }; -const BAR: usize = { +const READ_INTERIOR_MUT: usize = { static FOO: AtomicUsize = AtomicUsize::new(0); unsafe { *(&FOO as *const _ as *const usize) } //~ WARN any use of this value will cause an err //~^ WARN skipping const checks }; static mut MUTABLE: u32 = 0; -const BAD: u32 = unsafe { MUTABLE }; //~ WARN any use of this value will cause an error +const READ_MUT: u32 = unsafe { MUTABLE }; //~ WARN any use of this value will cause an error //~^ WARN skipping const checks // ok some day perhaps -const BOO_OK: &usize = { //~ ERROR it is undefined behavior to use this value +const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value static FOO: usize = 0; &FOO //~^ WARN skipping const checks diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr index 6ae88558d70..eae76c1389b 100644 --- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr +++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr @@ -23,10 +23,10 @@ LL | unsafe { *(&FOO as *const _ as *const usize) } | ^^^ warning: skipping const checks - --> $DIR/const_refers_to_static.rs:29:27 + --> $DIR/const_refers_to_static.rs:29:32 | -LL | const BAD: u32 = unsafe { MUTABLE }; - | ^^^^^^^ +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | ^^^^^^^ warning: skipping const checks --> $DIR/const_refers_to_static.rs:35:6 @@ -37,7 +37,7 @@ LL | &FOO error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static.rs:9:1 | -LL | / const BOO: &usize = { +LL | / const REF_INTERIOR_MUT: &usize = { LL | | static FOO: AtomicUsize = AtomicUsize::new(0); LL | | unsafe { &*(&FOO as *const _ as *const usize) } LL | | @@ -49,7 +49,7 @@ LL | | }; warning: any use of this value will cause an error --> $DIR/const_refers_to_static.rs:17:5 | -LL | / const FOO: usize = { +LL | / const MUTATE_INTERIOR_MUT: usize = { LL | | static FOO: AtomicUsize = AtomicUsize::new(0); LL | | FOO.fetch_add(1, Ordering::Relaxed) | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `std::sync::atomic::AtomicUsize::fetch_add` @@ -67,7 +67,7 @@ LL | #![warn(const_err)] warning: any use of this value will cause an error --> $DIR/const_refers_to_static.rs:24:14 | -LL | / const BAR: usize = { +LL | / const READ_INTERIOR_MUT: usize = { LL | | static FOO: AtomicUsize = AtomicUsize::new(0); LL | | unsafe { *(&FOO as *const _ as *const usize) } | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static @@ -76,17 +76,17 @@ LL | | }; | |__- warning: any use of this value will cause an error - --> $DIR/const_refers_to_static.rs:29:27 + --> $DIR/const_refers_to_static.rs:29:32 | -LL | const BAD: u32 = unsafe { MUTABLE }; - | --------------------------^^^^^^^--- - | | - | constant accesses static +LL | const READ_MUT: u32 = unsafe { MUTABLE }; + | -------------------------------^^^^^^^--- + | | + | constant accesses static error[E0080]: it is undefined behavior to use this value --> $DIR/const_refers_to_static.rs:33:1 | -LL | / const BOO_OK: &usize = { +LL | / const READ_IMMUT: &usize = { LL | | static FOO: usize = 0; LL | | &FOO LL | | |
