summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/miri_unleashed/const_refers_to_static2.32bit.stderr
blob: 14173ac9f69b4aff5e376db4e1a4f6892c71baf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
error[E0080]: it is undefined behavior to use this value
  --> $DIR/const_refers_to_static2.rs:11:1
   |
LL | const REF_INTERIOR_MUT: &usize = {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
   |
   = 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.
   = note: the raw bytes of the constant (size: 4, align: 4) {
               ╾─alloc1──╼                                     │ ╾──╼
           }

error[E0080]: it is undefined behavior to use this value
  --> $DIR/const_refers_to_static2.rs:18:1
   |
LL | const READ_IMMUT: &usize = {
   | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
   |
   = 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.
   = note: the raw bytes of the constant (size: 4, align: 4) {
               ╾─alloc2──╼                                     │ ╾──╼
           }

warning: skipping const checks
   |
help: skipping check that does not even have a feature gate
  --> $DIR/const_refers_to_static2.rs:14:18
   |
LL |     unsafe { &*(&FOO as *const _ as *const usize) }
   |                  ^^^
help: skipping check that does not even have a feature gate
  --> $DIR/const_refers_to_static2.rs:21:6
   |
LL |     &FOO
   |      ^^^

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0080`.