@@ -23,10 +23,10 @@ LL | unsafe { *(&FOO as *const _ as *const usize) }
2323 | ^^^
2424
2525warning: skipping const checks
26- --> $DIR/const_refers_to_static.rs:29:27
26+ --> $DIR/const_refers_to_static.rs:29:32
2727 |
28- LL | const BAD : u32 = unsafe { MUTABLE };
29- | ^^^^^^^
28+ LL | const READ_MUT : u32 = unsafe { MUTABLE };
29+ | ^^^^^^^
3030
3131warning: skipping const checks
3232 --> $DIR/const_refers_to_static.rs:35:6
@@ -37,7 +37,7 @@ LL | &FOO
3737error[E0080]: it is undefined behavior to use this value
3838 --> $DIR/const_refers_to_static.rs:9:1
3939 |
40- LL | / const BOO : &usize = {
40+ LL | / const REF_INTERIOR_MUT : &usize = {
4141LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
4242LL | | unsafe { &*(&FOO as *const _ as *const usize) }
4343LL | |
@@ -49,7 +49,7 @@ LL | | };
4949warning: any use of this value will cause an error
5050 --> $DIR/const_refers_to_static.rs:17:5
5151 |
52- LL | / const FOO : usize = {
52+ LL | / const MUTATE_INTERIOR_MUT : usize = {
5353LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
5454LL | | FOO.fetch_add(1, Ordering::Relaxed)
5555 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `std::sync::atomic::AtomicUsize::fetch_add`
@@ -67,7 +67,7 @@ LL | #![warn(const_err)]
6767warning: any use of this value will cause an error
6868 --> $DIR/const_refers_to_static.rs:24:14
6969 |
70- LL | / const BAR : usize = {
70+ LL | / const READ_INTERIOR_MUT : usize = {
7171LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
7272LL | | unsafe { *(&FOO as *const _ as *const usize) }
7373 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
@@ -76,17 +76,17 @@ LL | | };
7676 | |__-
7777
7878warning: any use of this value will cause an error
79- --> $DIR/const_refers_to_static.rs:29:27
79+ --> $DIR/const_refers_to_static.rs:29:32
8080 |
81- LL | const BAD : u32 = unsafe { MUTABLE };
82- | --------------------------^^^^^^^---
83- | |
84- | constant accesses static
81+ LL | const READ_MUT : u32 = unsafe { MUTABLE };
82+ | ------------------------------- ^^^^^^^---
83+ | |
84+ | constant accesses static
8585
8686error[E0080]: it is undefined behavior to use this value
8787 --> $DIR/const_refers_to_static.rs:33:1
8888 |
89- LL | / const BOO_OK : &usize = {
89+ LL | / const READ_IMMUT : &usize = {
9090LL | | static FOO: usize = 0;
9191LL | | &FOO
9292LL | |
0 commit comments