]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/miri_unleashed/const_refers_to_static2.64bit.stderr
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
[rust.git] / src / test / ui / consts / miri_unleashed / const_refers_to_static2.64bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/const_refers_to_static2.rs:11:1
3    |
4 LL | / const REF_INTERIOR_MUT: &usize = {
5 LL | |
6 LL | |     static FOO: AtomicUsize = AtomicUsize::new(0);
7 LL | |     unsafe { &*(&FOO as *const _ as *const usize) }
8 LL | | };
9    | |__^ type validation failed: encountered a reference pointing to a static variable
10    |
11    = 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.
12    = note: the raw bytes of the constant (size: 8, align: 8) {
13                ╾───────alloc1────────╼                         │ ╾──────╼
14            }
15
16 error[E0080]: it is undefined behavior to use this value
17   --> $DIR/const_refers_to_static2.rs:18:1
18    |
19 LL | / const READ_IMMUT: &usize = {
20 LL | |
21 LL | |     static FOO: usize = 0;
22 LL | |     &FOO
23 LL | | };
24    | |__^ type validation failed: encountered a reference pointing to a static variable
25    |
26    = 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.
27    = note: the raw bytes of the constant (size: 8, align: 8) {
28                ╾───────alloc2────────╼                         │ ╾──────╼
29            }
30
31 warning: skipping const checks
32    |
33 help: skipping check that does not even have a feature gate
34   --> $DIR/const_refers_to_static2.rs:14:18
35    |
36 LL |     unsafe { &*(&FOO as *const _ as *const usize) }
37    |                  ^^^
38 help: skipping check that does not even have a feature gate
39   --> $DIR/const_refers_to_static2.rs:21:6
40    |
41 LL |     &FOO
42    |      ^^^
43
44 error: aborting due to 2 previous errors; 1 warning emitted
45
46 For more information about this error, try `rustc --explain E0080`.