]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-pointer-values-in-various-types.stderr
Rollup merge of #62257 - RalfJung:miri-c-str, r=estebank
[rust.git] / src / test / ui / consts / const-eval / const-pointer-values-in-various-types.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/const-pointer-values-in-various-types.rs:24:5
3    |
4 LL |     const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
6    |
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 rust compiler repository if you believe it should not be considered undefined behavior
8
9 error: any use of this value will cause an error
10   --> $DIR/const-pointer-values-in-various-types.rs:27:43
11    |
12 LL |     const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
13    |     --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
14    |                                           |
15    |                                           a raw memory access tried to access part of a pointer value as raw bytes
16    |
17    = note: #[deny(const_err)] on by default
18
19 error: any use of this value will cause an error
20   --> $DIR/const-pointer-values-in-various-types.rs:30:45
21    |
22 LL |     const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
23    |     ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
24    |                                             |
25    |                                             a raw memory access tried to access part of a pointer value as raw bytes
26
27 error: any use of this value will cause an error
28   --> $DIR/const-pointer-values-in-various-types.rs:33:45
29    |
30 LL |     const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
31    |     ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
32    |                                             |
33    |                                             a raw memory access tried to access part of a pointer value as raw bytes
34
35 error[E0080]: it is undefined behavior to use this value
36   --> $DIR/const-pointer-values-in-various-types.rs:36:5
37    |
38 LL |     const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
39    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
40    |
41    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
42
43 error[E0080]: it is undefined behavior to use this value
44   --> $DIR/const-pointer-values-in-various-types.rs:39:5
45    |
46 LL |     const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
47    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
48    |
49    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
50
51 error: any use of this value will cause an error
52   --> $DIR/const-pointer-values-in-various-types.rs:42:43
53    |
54 LL |     const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
55    |     --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
56    |                                           |
57    |                                           a raw memory access tried to access part of a pointer value as raw bytes
58
59 error: any use of this value will cause an error
60   --> $DIR/const-pointer-values-in-various-types.rs:45:45
61    |
62 LL |     const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
63    |     ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
64    |                                             |
65    |                                             a raw memory access tried to access part of a pointer value as raw bytes
66
67 error: any use of this value will cause an error
68   --> $DIR/const-pointer-values-in-various-types.rs:48:45
69    |
70 LL |     const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
71    |     ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
72    |                                             |
73    |                                             a raw memory access tried to access part of a pointer value as raw bytes
74
75 error[E0080]: it is undefined behavior to use this value
76   --> $DIR/const-pointer-values-in-various-types.rs:51:5
77    |
78 LL |     const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
79    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
80    |
81    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
82
83 error[E0080]: it is undefined behavior to use this value
84   --> $DIR/const-pointer-values-in-various-types.rs:54:5
85    |
86 LL |     const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
87    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes
88    |
89    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
90
91 error: any use of this value will cause an error
92   --> $DIR/const-pointer-values-in-various-types.rs:57:45
93    |
94 LL |     const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
95    |     ----------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
96    |                                             |
97    |                                             a raw memory access tried to access part of a pointer value as raw bytes
98
99 error[E0080]: it is undefined behavior to use this value
100   --> $DIR/const-pointer-values-in-various-types.rs:60:5
101    |
102 LL |     const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
103    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
104    |
105    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
106
107 error: any use of this value will cause an error
108   --> $DIR/const-pointer-values-in-various-types.rs:63:47
109    |
110 LL |     const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
111    |     ------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
112    |                                               |
113    |                                               a raw memory access tried to access part of a pointer value as raw bytes
114
115 error: any use of this value will cause an error
116   --> $DIR/const-pointer-values-in-various-types.rs:66:47
117    |
118 LL |     const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
119    |     ------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
120    |                                               |
121    |                                               a raw memory access tried to access part of a pointer value as raw bytes
122
123 error: any use of this value will cause an error
124   --> $DIR/const-pointer-values-in-various-types.rs:69:39
125    |
126 LL |     const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
127    |     ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
128    |                                       |
129    |                                       a raw memory access tried to access part of a pointer value as raw bytes
130
131 error: any use of this value will cause an error
132   --> $DIR/const-pointer-values-in-various-types.rs:72:41
133    |
134 LL |     const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
135    |     ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
136    |                                         |
137    |                                         a raw memory access tried to access part of a pointer value as raw bytes
138
139 error: any use of this value will cause an error
140   --> $DIR/const-pointer-values-in-various-types.rs:75:41
141    |
142 LL |     const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
143    |     ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
144    |                                         |
145    |                                         a raw memory access tried to access part of a pointer value as raw bytes
146
147 error[E0080]: it is undefined behavior to use this value
148   --> $DIR/const-pointer-values-in-various-types.rs:78:5
149    |
150 LL |     const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
151    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
152    |
153    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
154
155 error: any use of this value will cause an error
156   --> $DIR/const-pointer-values-in-various-types.rs:81:43
157    |
158 LL |     const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
159    |     --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
160    |                                           |
161    |                                           a raw memory access tried to access part of a pointer value as raw bytes
162
163 error: any use of this value will cause an error
164   --> $DIR/const-pointer-values-in-various-types.rs:84:39
165    |
166 LL |     const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
167    |     ----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
168    |                                       |
169    |                                       a raw memory access tried to access part of a pointer value as raw bytes
170
171 error: any use of this value will cause an error
172   --> $DIR/const-pointer-values-in-various-types.rs:87:41
173    |
174 LL |     const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
175    |     ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
176    |                                         |
177    |                                         a raw memory access tried to access part of a pointer value as raw bytes
178
179 error: any use of this value will cause an error
180   --> $DIR/const-pointer-values-in-various-types.rs:90:41
181    |
182 LL |     const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
183    |     ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
184    |                                         |
185    |                                         a raw memory access tried to access part of a pointer value as raw bytes
186
187 error[E0080]: it is undefined behavior to use this value
188   --> $DIR/const-pointer-values-in-various-types.rs:93:5
189    |
190 LL |     const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
191    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
192    |
193    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
194
195 error: any use of this value will cause an error
196   --> $DIR/const-pointer-values-in-various-types.rs:96:43
197    |
198 LL |     const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
199    |     --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
200    |                                           |
201    |                                           a raw memory access tried to access part of a pointer value as raw bytes
202
203 error: any use of this value will cause an error
204   --> $DIR/const-pointer-values-in-various-types.rs:99:41
205    |
206 LL |     const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
207    |     ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
208    |                                         |
209    |                                         a raw memory access tried to access part of a pointer value as raw bytes
210
211 error[E0080]: it is undefined behavior to use this value
212   --> $DIR/const-pointer-values-in-various-types.rs:102:5
213    |
214 LL |     const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
215    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
216    |
217    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
218
219 error: any use of this value will cause an error
220   --> $DIR/const-pointer-values-in-various-types.rs:105:43
221    |
222 LL |     const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
223    |     --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
224    |                                           |
225    |                                           a raw memory access tried to access part of a pointer value as raw bytes
226
227 error: any use of this value will cause an error
228   --> $DIR/const-pointer-values-in-various-types.rs:108:43
229    |
230 LL |     const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
231    |     --------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
232    |                                           |
233    |                                           a raw memory access tried to access part of a pointer value as raw bytes
234
235 error: aborting due to 29 previous errors
236
237 For more information about this error, try `rustc --explain E0080`.