]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
New upstream version 1.64.0+dfsg1
[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
064997fb 45error: any use of this value will cause an error
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 = note: `#[deny(const_err)]` on by default
52 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
53 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
54 = help: this code performed an operation that depends on the underlying bytes representing a pointer
55 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
0bf4aa26 56
064997fb
FG
57error: any use of this value will cause an error
58 --> $DIR/ub-ref-ptr.rs:35:39
0bf4aa26
XL
59 |
60LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
064997fb 61 | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
0bf4aa26 62 |
064997fb
FG
63 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
64 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
65 = help: this code performed an operation that depends on the underlying bytes representing a pointer
66 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
0bf4aa26 67
064997fb
FG
68error: any use of this value will cause an error
69 --> $DIR/ub-ref-ptr.rs:35:38
70 |
71LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
72 | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
73 |
74 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
75 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
76
77error: any use of this value will cause an error
78 --> $DIR/ub-ref-ptr.rs:41:86
74b04a01
XL
79 |
80LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
064997fb 81 | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
74b04a01 82 |
064997fb
FG
83 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
84 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
85 = help: this code performed an operation that depends on the underlying bytes representing a pointer
86 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
87
88error: any use of this value will cause an error
89 --> $DIR/ub-ref-ptr.rs:41:85
90 |
91LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
92 | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
93 |
94 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
95 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
74b04a01
XL
96
97error[E0080]: it is undefined behavior to use this value
064997fb 98 --> $DIR/ub-ref-ptr.rs:47:1
0bf4aa26
XL
99 |
100LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
064997fb 101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
74b04a01
XL
102 |
103 = 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
104 = note: the raw bytes of the constant (size: 8, align: 8) {
105 39 05 00 00 00 00 00 00 │ 9.......
106 }
74b04a01
XL
107
108error[E0080]: it is undefined behavior to use this value
064997fb 109 --> $DIR/ub-ref-ptr.rs:50:1
74b04a01
XL
110 |
111LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
064997fb 112 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
0bf4aa26 113 |
e1599b0c 114 = 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
115 = note: the raw bytes of the constant (size: 8, align: 8) {
116 39 05 00 00 00 00 00 00 │ 9.......
117 }
0bf4aa26 118
6a06907d 119error[E0080]: it is undefined behavior to use this value
064997fb 120 --> $DIR/ub-ref-ptr.rs:53:1
6a06907d
XL
121 |
122LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
064997fb 123 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized raw pointer
6a06907d
XL
124 |
125 = 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
126 = note: the raw bytes of the constant (size: 8, align: 8) {
127 __ __ __ __ __ __ __ __ │ ░░░░░░░░
128 }
6a06907d
XL
129
130error[E0080]: it is undefined behavior to use this value
064997fb 131 --> $DIR/ub-ref-ptr.rs:56:1
5e7ed085
FG
132 |
133LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
064997fb 134 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
5e7ed085
FG
135 |
136 = 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.
137 = note: the raw bytes of the constant (size: 8, align: 8) {
138 00 00 00 00 00 00 00 00 │ ........
139 }
140
141error[E0080]: it is undefined behavior to use this value
064997fb 142 --> $DIR/ub-ref-ptr.rs:58:1
6a06907d
XL
143 |
144LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
064997fb 145 | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered uninitialized bytes, but expected a proper pointer or integer value
6a06907d
XL
146 |
147 = 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
148 = note: the raw bytes of the constant (size: 8, align: 8) {
149 __ __ __ __ __ __ __ __ │ ░░░░░░░░
150 }
6a06907d 151
5e7ed085 152error[E0080]: it is undefined behavior to use this value
064997fb 153 --> $DIR/ub-ref-ptr.rs:60:1
5e7ed085
FG
154 |
155LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
064997fb 156 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
5e7ed085
FG
157 |
158 = 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.
159 = note: the raw bytes of the constant (size: 8, align: 8) {
160 0d 00 00 00 00 00 00 00 │ ........
161 }
162
163error[E0080]: it is undefined behavior to use this value
064997fb 164 --> $DIR/ub-ref-ptr.rs:62:1
5e7ed085
FG
165 |
166LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
064997fb 167 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer
5e7ed085
FG
168 |
169 = 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.
170 = note: the raw bytes of the constant (size: 8, align: 8) {
064997fb 171 ╾───────alloc41───────╼ │ ╾──────╼
5e7ed085
FG
172 }
173
064997fb 174error: aborting due to 16 previous errors
0bf4aa26
XL
175
176For more information about this error, try `rustc --explain E0080`.
064997fb
FG
177Future incompatibility report: Future breakage diagnostic:
178error: any use of this value will cause an error
179 --> $DIR/ub-ref-ptr.rs:31:1
180 |
181LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
182 | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
183 |
184 = note: `#[deny(const_err)]` on by default
185 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
186 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
187 = help: this code performed an operation that depends on the underlying bytes representing a pointer
188 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
189
190Future breakage diagnostic:
191error: any use of this value will cause an error
192 --> $DIR/ub-ref-ptr.rs:35:39
193 |
194LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
195 | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
196 |
197 = note: `#[deny(const_err)]` on by default
198 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
199 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
200 = help: this code performed an operation that depends on the underlying bytes representing a pointer
201 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
202
203Future breakage diagnostic:
204error: any use of this value will cause an error
205 --> $DIR/ub-ref-ptr.rs:35:38
206 |
207LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
208 | ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
209 |
210 = note: `#[deny(const_err)]` on by default
211 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
212 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
213
214Future breakage diagnostic:
215error: any use of this value will cause an error
216 --> $DIR/ub-ref-ptr.rs:41:86
217 |
218LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
219 | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
220 |
221 = note: `#[deny(const_err)]` on by default
222 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
223 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
224 = help: this code performed an operation that depends on the underlying bytes representing a pointer
225 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
226
227Future breakage diagnostic:
228error: any use of this value will cause an error
229 --> $DIR/ub-ref-ptr.rs:41:85
230 |
231LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
232 | ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
233 |
234 = note: `#[deny(const_err)]` on by default
235 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
236 = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
237