|
1 | 1 | warning: skipping const checks
|
2 |
| - --> $DIR/const_refers_to_static.rs:11:18 |
3 |
| - | |
4 |
| -LL | unsafe { &*(&FOO as *const _ as *const usize) } |
5 |
| - | ^^^ |
6 |
| - |
7 |
| -warning: skipping const checks |
8 |
| - --> $DIR/const_refers_to_static.rs:17:5 |
| 2 | + --> $DIR/const_refers_to_static.rs:14:5 |
9 | 3 | |
|
10 | 4 | LL | FOO.fetch_add(1, Ordering::Relaxed)
|
11 | 5 | | ^^^
|
12 | 6 |
|
13 | 7 | warning: skipping const checks
|
14 |
| - --> $DIR/const_refers_to_static.rs:17:5 |
| 8 | + --> $DIR/const_refers_to_static.rs:14:5 |
15 | 9 | |
|
16 | 10 | LL | FOO.fetch_add(1, Ordering::Relaxed)
|
17 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
18 | 12 |
|
19 | 13 | warning: skipping const checks
|
20 |
| - --> $DIR/const_refers_to_static.rs:24:17 |
| 14 | + --> $DIR/const_refers_to_static.rs:21:17 |
21 | 15 | |
|
22 | 16 | LL | unsafe { *(&FOO as *const _ as *const usize) }
|
23 | 17 | | ^^^
|
24 | 18 |
|
25 | 19 | warning: skipping const checks
|
26 |
| - --> $DIR/const_refers_to_static.rs:29:32 |
| 20 | + --> $DIR/const_refers_to_static.rs:26:32 |
27 | 21 | |
|
28 | 22 | LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
29 | 23 | | ^^^^^^^
|
30 | 24 |
|
31 | 25 | warning: skipping const checks
|
32 |
| - --> $DIR/const_refers_to_static.rs:29:32 |
| 26 | + --> $DIR/const_refers_to_static.rs:26:32 |
33 | 27 | |
|
34 | 28 | LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
35 | 29 | | ^^^^^^^
|
36 | 30 |
|
37 |
| -warning: skipping const checks |
38 |
| - --> $DIR/const_refers_to_static.rs:36:6 |
| 31 | +error[E0080]: erroneous constant used |
| 32 | + --> $DIR/const_refers_to_static.rs:31:5 |
39 | 33 | |
|
40 |
| -LL | &FOO |
41 |
| - | ^^^ |
| 34 | +LL | MUTATE_INTERIOR_MUT; |
| 35 | + | ^^^^^^^^^^^^^^^^^^^ referenced constant has errors |
42 | 36 |
|
43 |
| -error[E0080]: it is undefined behavior to use this value |
44 |
| - --> $DIR/const_refers_to_static.rs:9:1 |
| 37 | +error[E0080]: erroneous constant used |
| 38 | + --> $DIR/const_refers_to_static.rs:33:5 |
45 | 39 | |
|
46 |
| -LL | / const REF_INTERIOR_MUT: &usize = { |
47 |
| -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); |
48 |
| -LL | | unsafe { &*(&FOO as *const _ as *const usize) } |
49 |
| -LL | | |
50 |
| -LL | | }; |
51 |
| - | |__^ type validation failed: encountered a reference pointing to a static variable |
52 |
| - | |
53 |
| - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. |
| 40 | +LL | READ_INTERIOR_MUT; |
| 41 | + | ^^^^^^^^^^^^^^^^^ referenced constant has errors |
54 | 42 |
|
55 |
| -warning: any use of this value will cause an error |
56 |
| - --> $DIR/const_refers_to_static.rs:17:5 |
57 |
| - | |
58 |
| -LL | / const MUTATE_INTERIOR_MUT: usize = { |
59 |
| -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); |
60 |
| -LL | | FOO.fetch_add(1, Ordering::Relaxed) |
61 |
| - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `std::sync::atomic::AtomicUsize::fetch_add` |
62 |
| -LL | | |
63 |
| -LL | | |
64 |
| -LL | | }; |
65 |
| - | |__- |
66 |
| - | |
67 |
| -note: the lint level is defined here |
68 |
| - --> $DIR/const_refers_to_static.rs:2:9 |
69 |
| - | |
70 |
| -LL | #![warn(const_err)] |
71 |
| - | ^^^^^^^^^ |
72 |
| - |
73 |
| -warning: any use of this value will cause an error |
74 |
| - --> $DIR/const_refers_to_static.rs:24:14 |
75 |
| - | |
76 |
| -LL | / const READ_INTERIOR_MUT: usize = { |
77 |
| -LL | | static FOO: AtomicUsize = AtomicUsize::new(0); |
78 |
| -LL | | unsafe { *(&FOO as *const _ as *const usize) } |
79 |
| - | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static |
80 |
| -LL | | |
81 |
| -LL | | }; |
82 |
| - | |__- |
83 |
| - |
84 |
| -warning: any use of this value will cause an error |
85 |
| - --> $DIR/const_refers_to_static.rs:29:32 |
86 |
| - | |
87 |
| -LL | const READ_MUT: u32 = unsafe { MUTABLE }; |
88 |
| - | -------------------------------^^^^^^^--- |
89 |
| - | | |
90 |
| - | constant accesses static |
91 |
| - |
92 |
| -error[E0080]: it is undefined behavior to use this value |
93 |
| - --> $DIR/const_refers_to_static.rs:34:1 |
94 |
| - | |
95 |
| -LL | / const READ_IMMUT: &usize = { |
96 |
| -LL | | static FOO: usize = 0; |
97 |
| -LL | | &FOO |
98 |
| -LL | | |
99 |
| -LL | | }; |
100 |
| - | |__^ type validation failed: encountered a reference pointing to a static variable |
| 43 | +error[E0080]: erroneous constant used |
| 44 | + --> $DIR/const_refers_to_static.rs:35:5 |
101 | 45 | |
|
102 |
| - = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. |
| 46 | +LL | READ_MUT; |
| 47 | + | ^^^^^^^^ referenced constant has errors |
103 | 48 |
|
104 |
| -error: aborting due to 2 previous errors; 10 warnings emitted |
| 49 | +error: aborting due to 3 previous errors; 5 warnings emitted |
105 | 50 |
|
106 | 51 | For more information about this error, try `rustc --explain E0080`.
|
0 commit comments