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