]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
Rollup merge of #98640 - cuviper:stable-rust-analyzer, r=Mark-Simulacrum
[rust.git] / src / test / ui / consts / miri_unleashed / const_refers_to_static_cross_crate.32bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/const_refers_to_static_cross_crate.rs:12:1
3    |
4 LL | / const SLICE_MUT: &[u8; 1] = {
5 LL | |
6 LL | |     unsafe { &static_cross_crate::ZERO }
7 LL | | };
8    | |__^ constructing invalid value: encountered a reference pointing to a static variable
9    |
10    = 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.
11    = note: the raw bytes of the constant (size: 4, align: 4) {
12                ╾─alloc1──╼                                     │ ╾──╼
13            }
14
15 error: could not evaluate constant pattern
16   --> $DIR/const_refers_to_static_cross_crate.rs:40:9
17    |
18 LL |         SLICE_MUT => true,
19    |         ^^^^^^^^^
20
21 error[E0080]: it is undefined behavior to use this value
22   --> $DIR/const_refers_to_static_cross_crate.rs:17:1
23    |
24 LL | / const U8_MUT: &u8 = {
25 LL | |
26 LL | |     unsafe { &static_cross_crate::ZERO[0] }
27 LL | | };
28    | |__^ constructing invalid value: encountered a reference pointing to a static variable
29    |
30    = 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.
31    = note: the raw bytes of the constant (size: 4, align: 4) {
32                ╾─alloc1──╼                                     │ ╾──╼
33            }
34
35 error: could not evaluate constant pattern
36   --> $DIR/const_refers_to_static_cross_crate.rs:49:9
37    |
38 LL |         U8_MUT => true,
39    |         ^^^^^^
40
41 warning: any use of this value will cause an error
42   --> $DIR/const_refers_to_static_cross_crate.rs:25:15
43    |
44 LL | / const U8_MUT2: &u8 = {
45 LL | |     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
46    | |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
47 LL | |
48 LL | |
49 LL | |
50 LL | | };
51    | |__-
52    |
53 note: the lint level is defined here
54   --> $DIR/const_refers_to_static_cross_crate.rs:23:8
55    |
56 LL | #[warn(const_err)]
57    |        ^^^^^^^^^
58    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
59    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
60
61 error: could not evaluate constant pattern
62   --> $DIR/const_refers_to_static_cross_crate.rs:60:9
63    |
64 LL |         U8_MUT2 => true,
65    |         ^^^^^^^
66
67 warning: any use of this value will cause an error
68   --> $DIR/const_refers_to_static_cross_crate.rs:32:20
69    |
70 LL | / const U8_MUT3: &u8 = {
71 LL | |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
72    | |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
73 LL | |
74 LL | |
75 LL | |
76 LL | | };
77    | |__-
78    |
79 note: the lint level is defined here
80   --> $DIR/const_refers_to_static_cross_crate.rs:30:8
81    |
82 LL | #[warn(const_err)]
83    |        ^^^^^^^^^
84    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
85    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
86
87 error: could not evaluate constant pattern
88   --> $DIR/const_refers_to_static_cross_crate.rs:68:9
89    |
90 LL |         U8_MUT3 => true,
91    |         ^^^^^^^
92
93 error: could not evaluate constant pattern
94   --> $DIR/const_refers_to_static_cross_crate.rs:40:9
95    |
96 LL |         SLICE_MUT => true,
97    |         ^^^^^^^^^
98
99 error: could not evaluate constant pattern
100   --> $DIR/const_refers_to_static_cross_crate.rs:49:9
101    |
102 LL |         U8_MUT => true,
103    |         ^^^^^^
104
105 error: could not evaluate constant pattern
106   --> $DIR/const_refers_to_static_cross_crate.rs:60:9
107    |
108 LL |         U8_MUT2 => true,
109    |         ^^^^^^^
110
111 error: could not evaluate constant pattern
112   --> $DIR/const_refers_to_static_cross_crate.rs:68:9
113    |
114 LL |         U8_MUT3 => true,
115    |         ^^^^^^^
116
117 warning: skipping const checks
118    |
119 help: skipping check that does not even have a feature gate
120   --> $DIR/const_refers_to_static_cross_crate.rs:14:15
121    |
122 LL |     unsafe { &static_cross_crate::ZERO }
123    |               ^^^^^^^^^^^^^^^^^^^^^^^^
124 help: skipping check that does not even have a feature gate
125   --> $DIR/const_refers_to_static_cross_crate.rs:14:15
126    |
127 LL |     unsafe { &static_cross_crate::ZERO }
128    |               ^^^^^^^^^^^^^^^^^^^^^^^^
129 help: skipping check that does not even have a feature gate
130   --> $DIR/const_refers_to_static_cross_crate.rs:19:15
131    |
132 LL |     unsafe { &static_cross_crate::ZERO[0] }
133    |               ^^^^^^^^^^^^^^^^^^^^^^^^
134 help: skipping check that does not even have a feature gate
135   --> $DIR/const_refers_to_static_cross_crate.rs:19:15
136    |
137 LL |     unsafe { &static_cross_crate::ZERO[0] }
138    |               ^^^^^^^^^^^^^^^^^^^^^^^^
139 help: skipping check that does not even have a feature gate
140   --> $DIR/const_refers_to_static_cross_crate.rs:19:15
141    |
142 LL |     unsafe { &static_cross_crate::ZERO[0] }
143    |               ^^^^^^^^^^^^^^^^^^^^^^^^
144 help: skipping check that does not even have a feature gate
145   --> $DIR/const_refers_to_static_cross_crate.rs:25:17
146    |
147 LL |     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
148    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149 help: skipping check that does not even have a feature gate
150   --> $DIR/const_refers_to_static_cross_crate.rs:32:20
151    |
152 LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
153    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154 help: skipping check that does not even have a feature gate
155   --> $DIR/const_refers_to_static_cross_crate.rs:32:20
156    |
157 LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
158    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
159 help: skipping check that does not even have a feature gate
160   --> $DIR/const_refers_to_static_cross_crate.rs:32:20
161    |
162 LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
163    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164 help: skipping check that does not even have a feature gate
165   --> $DIR/const_refers_to_static_cross_crate.rs:32:20
166    |
167 LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
168    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169
170 error: aborting due to 10 previous errors; 3 warnings emitted
171
172 For more information about this error, try `rustc --explain E0080`.
173 Future incompatibility report: Future breakage diagnostic:
174 warning: any use of this value will cause an error
175   --> $DIR/const_refers_to_static_cross_crate.rs:25:15
176    |
177 LL | / const U8_MUT2: &u8 = {
178 LL | |     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
179    | |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
180 LL | |
181 LL | |
182 LL | |
183 LL | | };
184    | |__-
185    |
186 note: the lint level is defined here
187   --> $DIR/const_refers_to_static_cross_crate.rs:23:8
188    |
189 LL | #[warn(const_err)]
190    |        ^^^^^^^^^
191    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
192    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
193
194 Future breakage diagnostic:
195 warning: any use of this value will cause an error
196   --> $DIR/const_refers_to_static_cross_crate.rs:32:20
197    |
198 LL | / const U8_MUT3: &u8 = {
199 LL | |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
200    | |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
201 LL | |
202 LL | |
203 LL | |
204 LL | | };
205    | |__-
206    |
207 note: the lint level is defined here
208   --> $DIR/const_refers_to_static_cross_crate.rs:30:8
209    |
210 LL | #[warn(const_err)]
211    |        ^^^^^^^^^
212    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
213    = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
214