@@ -23,10 +23,10 @@ LL | unsafe { *(&FOO as *const _ as *const usize) }
23
23
| ^^^
24
24
25
25
warning: skipping const checks
26
- --> $DIR/const_refers_to_static.rs:29:27
26
+ --> $DIR/const_refers_to_static.rs:29:32
27
27
|
28
- LL | const BAD : u32 = unsafe { MUTABLE };
29
- | ^^^^^^^
28
+ LL | const READ_MUT : u32 = unsafe { MUTABLE };
29
+ | ^^^^^^^
30
30
31
31
warning: skipping const checks
32
32
--> $DIR/const_refers_to_static.rs:35:6
@@ -37,7 +37,7 @@ LL | &FOO
37
37
error[E0080]: it is undefined behavior to use this value
38
38
--> $DIR/const_refers_to_static.rs:9:1
39
39
|
40
- LL | / const BOO : &usize = {
40
+ LL | / const REF_INTERIOR_MUT : &usize = {
41
41
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
42
42
LL | | unsafe { &*(&FOO as *const _ as *const usize) }
43
43
LL | |
@@ -49,7 +49,7 @@ LL | | };
49
49
warning: any use of this value will cause an error
50
50
--> $DIR/const_refers_to_static.rs:17:5
51
51
|
52
- LL | / const FOO : usize = {
52
+ LL | / const MUTATE_INTERIOR_MUT : usize = {
53
53
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
54
54
LL | | FOO.fetch_add(1, Ordering::Relaxed)
55
55
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `std::sync::atomic::AtomicUsize::fetch_add`
@@ -67,7 +67,7 @@ LL | #![warn(const_err)]
67
67
warning: any use of this value will cause an error
68
68
--> $DIR/const_refers_to_static.rs:24:14
69
69
|
70
- LL | / const BAR : usize = {
70
+ LL | / const READ_INTERIOR_MUT : usize = {
71
71
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
72
72
LL | | unsafe { *(&FOO as *const _ as *const usize) }
73
73
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
@@ -76,17 +76,17 @@ LL | | };
76
76
| |__-
77
77
78
78
warning: 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
80
80
|
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
85
85
86
86
error[E0080]: it is undefined behavior to use this value
87
87
--> $DIR/const_refers_to_static.rs:33:1
88
88
|
89
- LL | / const BOO_OK : &usize = {
89
+ LL | / const READ_IMMUT : &usize = {
90
90
LL | | static FOO: usize = 0;
91
91
LL | | &FOO
92
92
LL | |
0 commit comments