]> git.proxmox.com Git - rustc.git/blame - tests/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
New upstream version 1.76.0+dfsg1
[rustc.git] / tests / ui / consts / miri_unleashed / const_refers_to_static.64bit.stderr
CommitLineData
2b03887a
FG
1error[E0080]: evaluation of constant value failed
2 --> $DIR/const_refers_to_static.rs:9:5
3 |
4LL | FOO.fetch_add(1, Ordering::Relaxed)
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add`
6
7error[E0080]: evaluation of constant value failed
8 --> $DIR/const_refers_to_static.rs:14:14
9 |
10LL | unsafe { *(&FOO as *const _ as *const usize) }
11 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
12
13error[E0080]: evaluation of constant value failed
14 --> $DIR/const_refers_to_static.rs:18:32
15 |
16LL | const READ_MUT: u32 = unsafe { MUTABLE };
17 | ^^^^^^^ constant accesses static
18
19error[E0080]: it is undefined behavior to use this value
20 --> $DIR/const_refers_to_static.rs:20:1
21 |
22LL | const REF_INTERIOR_MUT: &usize = {
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
24 |
25 = 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.
26 = note: the raw bytes of the constant (size: 8, align: 8) {
4b012472 27 ╾ALLOC0<imm>╼ │ ╾──────╼
2b03887a
FG
28 }
29
30error[E0080]: it is undefined behavior to use this value
31 --> $DIR/const_refers_to_static.rs:27:1
32 |
33LL | const READ_IMMUT: &usize = {
34 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
35 |
36 = 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.
37 = note: the raw bytes of the constant (size: 8, align: 8) {
4b012472 38 ╾ALLOC1<imm>╼ │ ╾──────╼
2b03887a
FG
39 }
40
41warning: skipping const checks
42 |
43help: skipping check that does not even have a feature gate
44 --> $DIR/const_refers_to_static.rs:9:5
45 |
46LL | FOO.fetch_add(1, Ordering::Relaxed)
47 | ^^^
48help: skipping check that does not even have a feature gate
49 --> $DIR/const_refers_to_static.rs:9:5
50 |
51LL | FOO.fetch_add(1, Ordering::Relaxed)
52 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53help: skipping check that does not even have a feature gate
54 --> $DIR/const_refers_to_static.rs:14:17
55 |
56LL | unsafe { *(&FOO as *const _ as *const usize) }
57 | ^^^
58help: skipping check that does not even have a feature gate
59 --> $DIR/const_refers_to_static.rs:18:32
60 |
61LL | const READ_MUT: u32 = unsafe { MUTABLE };
62 | ^^^^^^^
63help: skipping check that does not even have a feature gate
64 --> $DIR/const_refers_to_static.rs:18:32
65 |
66LL | const READ_MUT: u32 = unsafe { MUTABLE };
67 | ^^^^^^^
68help: skipping check that does not even have a feature gate
69 --> $DIR/const_refers_to_static.rs:23:18
70 |
71LL | unsafe { &*(&FOO as *const _ as *const usize) }
72 | ^^^
73help: skipping check that does not even have a feature gate
74 --> $DIR/const_refers_to_static.rs:30:6
75 |
76LL | &FOO
77 | ^^^
78
79error: aborting due to 5 previous errors; 1 warning emitted
80
81For more information about this error, try `rustc --explain E0080`.