]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
Update unsuspicious file list
[rustc.git] / src / test / ui / consts / const-eval / ub-ref-ptr.64bit.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
cdc7bbd5 2 --> $DIR/ub-ref-ptr.rs:13:1
0bf4aa26
XL
3 |
4LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
064997fb 5 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
0bf4aa26 6 |
e1599b0c 7 = 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.
cdc7bbd5 8 = note: the raw bytes of the constant (size: 8, align: 8) {
136023e0 9 ╾───────alloc3────────╼ │ ╾──────╼
cdc7bbd5 10 }
0bf4aa26 11
a1dfa0c6 12error[E0080]: it is undefined behavior to use this value
cdc7bbd5 13 --> $DIR/ub-ref-ptr.rs:17:1
0bf4aa26 14 |
74b04a01 15LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
064997fb 16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
74b04a01
XL
17 |
18 = 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.
cdc7bbd5 19 = note: the raw bytes of the constant (size: 8, align: 8) {
136023e0 20 ╾───────alloc7────────╼ │ ╾──────╼
cdc7bbd5 21 }
74b04a01
XL
22
23error[E0080]: it is undefined behavior to use this value
cdc7bbd5 24 --> $DIR/ub-ref-ptr.rs:21:1
74b04a01 25 |
0bf4aa26 26LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
064997fb 27 | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
74b04a01
XL
28 |
29 = 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.
cdc7bbd5
XL
30 = note: the raw bytes of the constant (size: 8, align: 8) {
31 00 00 00 00 00 00 00 00 │ ........
32 }
74b04a01
XL
33
34error[E0080]: it is undefined behavior to use this value
cdc7bbd5 35 --> $DIR/ub-ref-ptr.rs:24:1
74b04a01
XL
36 |
37LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
064997fb 38 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
0bf4aa26 39 |
e1599b0c 40 = 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.
cdc7bbd5
XL
41 = note: the raw bytes of the constant (size: 8, align: 8) {
42 00 00 00 00 00 00 00 00 │ ........
43 }
0bf4aa26 44
2b03887a 45error[E0080]: evaluation of constant value failed
5e7ed085 46 --> $DIR/ub-ref-ptr.rs:31:1
0bf4aa26
XL
47 |
48LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
064997fb 49 | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
0bf4aa26 50 |
064997fb
FG
51 = help: this code performed an operation that depends on the underlying bytes representing a pointer
52 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
0bf4aa26 53
2b03887a
FG
54error[E0080]: evaluation of constant value failed
55 --> $DIR/ub-ref-ptr.rs:34:39
0bf4aa26
XL
56 |
57LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
2b03887a 58 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
0bf4aa26 59 |
064997fb
FG
60 = help: this code performed an operation that depends on the underlying bytes representing a pointer
61 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
0bf4aa26 62
487cf647 63note: erroneous constant used
2b03887a 64 --> $DIR/ub-ref-ptr.rs:34:38
064997fb
FG
65 |
66LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
487cf647 67 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
064997fb 68
2b03887a 69error[E0080]: evaluation of constant value failed
487cf647 70 --> $DIR/ub-ref-ptr.rs:37:86
74b04a01
XL
71 |
72LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
2b03887a 73 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
74b04a01 74 |
064997fb
FG
75 = help: this code performed an operation that depends on the underlying bytes representing a pointer
76 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
77
487cf647
FG
78note: erroneous constant used
79 --> $DIR/ub-ref-ptr.rs:37:85
064997fb
FG
80 |
81LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
487cf647 82 | ^^^^^^^^^^^^^^^^^^^^^
74b04a01
XL
83
84error[E0080]: it is undefined behavior to use this value
487cf647 85 --> $DIR/ub-ref-ptr.rs:40:1
0bf4aa26
XL
86 |
87LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
064997fb 88 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
74b04a01
XL
89 |
90 = 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.
cdc7bbd5
XL
91 = note: the raw bytes of the constant (size: 8, align: 8) {
92 39 05 00 00 00 00 00 00 │ 9.......
93 }
74b04a01
XL
94
95error[E0080]: it is undefined behavior to use this value
487cf647 96 --> $DIR/ub-ref-ptr.rs:43:1
74b04a01
XL
97 |
98LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
064997fb 99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
0bf4aa26 100 |
e1599b0c 101 = 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.
cdc7bbd5
XL
102 = note: the raw bytes of the constant (size: 8, align: 8) {
103 39 05 00 00 00 00 00 00 │ 9.......
104 }
0bf4aa26 105
f2b60f7d 106error[E0080]: evaluation of constant value failed
487cf647 107 --> $DIR/ub-ref-ptr.rs:46:41
6a06907d
XL
108 |
109LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
f2b60f7d 110 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
6a06907d
XL
111
112error[E0080]: it is undefined behavior to use this value
487cf647 113 --> $DIR/ub-ref-ptr.rs:50:1
5e7ed085
FG
114 |
115LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
064997fb 116 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
5e7ed085
FG
117 |
118 = 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.
119 = note: the raw bytes of the constant (size: 8, align: 8) {
120 00 00 00 00 00 00 00 00 │ ........
121 }
122
f2b60f7d 123error[E0080]: evaluation of constant value failed
487cf647 124 --> $DIR/ub-ref-ptr.rs:52:38
6a06907d
XL
125 |
126LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
f2b60f7d 127 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
6a06907d 128
5e7ed085 129error[E0080]: it is undefined behavior to use this value
487cf647 130 --> $DIR/ub-ref-ptr.rs:55:1
5e7ed085
FG
131 |
132LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
064997fb 133 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
5e7ed085
FG
134 |
135 = 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.
136 = note: the raw bytes of the constant (size: 8, align: 8) {
137 0d 00 00 00 00 00 00 00 │ ........
138 }
139
140error[E0080]: it is undefined behavior to use this value
487cf647 141 --> $DIR/ub-ref-ptr.rs:57:1
5e7ed085
FG
142 |
143LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
064997fb 144 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer
5e7ed085
FG
145 |
146 = 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.
147 = note: the raw bytes of the constant (size: 8, align: 8) {
064997fb 148 ╾───────alloc41───────╼ │ ╾──────╼
5e7ed085
FG
149 }
150
487cf647 151error: aborting due to 14 previous errors
0bf4aa26
XL
152
153For more information about this error, try `rustc --explain E0080`.