11error: the type `&'static T` does not permit zero-initialization
2- --> $DIR/uninitialized-zeroed.rs:28 :32
2+ --> $DIR/uninitialized-zeroed.rs:29 :32
33 |
44LL | let _val: &'static T = mem::zeroed();
55 | ^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL | #![deny(invalid_value)]
1515 = note: References must be non-null
1616
1717error: the type `&'static T` does not permit being left uninitialized
18- --> $DIR/uninitialized-zeroed.rs:29 :32
18+ --> $DIR/uninitialized-zeroed.rs:30 :32
1919 |
2020LL | let _val: &'static T = mem::uninitialized();
2121 | ^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | let _val: &'static T = mem::uninitialized();
2626 = note: References must be non-null
2727
2828error: the type `Wrap<&'static T>` does not permit zero-initialization
29- --> $DIR/uninitialized-zeroed.rs:31 :38
29+ --> $DIR/uninitialized-zeroed.rs:32 :38
3030 |
3131LL | let _val: Wrap<&'static T> = mem::zeroed();
3232 | ^^^^^^^^^^^^^
@@ -35,13 +35,13 @@ LL | let _val: Wrap<&'static T> = mem::zeroed();
3535 | help: use `MaybeUninit<T>` instead
3636 |
3737note: References must be non-null (in this struct field)
38- --> $DIR/uninitialized-zeroed.rs:17 :18
38+ --> $DIR/uninitialized-zeroed.rs:18 :18
3939 |
4040LL | struct Wrap<T> { wrapped: T }
4141 | ^^^^^^^^^^
4242
4343error: the type `Wrap<&'static T>` does not permit being left uninitialized
44- --> $DIR/uninitialized-zeroed.rs:32 :38
44+ --> $DIR/uninitialized-zeroed.rs:33 :38
4545 |
4646LL | let _val: Wrap<&'static T> = mem::uninitialized();
4747 | ^^^^^^^^^^^^^^^^^^^^
@@ -50,13 +50,13 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized();
5050 | help: use `MaybeUninit<T>` instead
5151 |
5252note: References must be non-null (in this struct field)
53- --> $DIR/uninitialized-zeroed.rs:17 :18
53+ --> $DIR/uninitialized-zeroed.rs:18 :18
5454 |
5555LL | struct Wrap<T> { wrapped: T }
5656 | ^^^^^^^^^^
5757
5858error: the type `!` does not permit zero-initialization
59- --> $DIR/uninitialized-zeroed.rs:39 :23
59+ --> $DIR/uninitialized-zeroed.rs:40 :23
6060 |
6161LL | let _val: ! = mem::zeroed();
6262 | ^^^^^^^^^^^^^
@@ -67,7 +67,7 @@ LL | let _val: ! = mem::zeroed();
6767 = note: The never type (`!`) has no valid value
6868
6969error: the type `!` does not permit being left uninitialized
70- --> $DIR/uninitialized-zeroed.rs:40 :23
70+ --> $DIR/uninitialized-zeroed.rs:41 :23
7171 |
7272LL | let _val: ! = mem::uninitialized();
7373 | ^^^^^^^^^^^^^^^^^^^^
@@ -78,7 +78,7 @@ LL | let _val: ! = mem::uninitialized();
7878 = note: The never type (`!`) has no valid value
7979
8080error: the type `(i32, !)` does not permit zero-initialization
81- --> $DIR/uninitialized-zeroed.rs:42 :30
81+ --> $DIR/uninitialized-zeroed.rs:43 :30
8282 |
8383LL | let _val: (i32, !) = mem::zeroed();
8484 | ^^^^^^^^^^^^^
@@ -89,7 +89,7 @@ LL | let _val: (i32, !) = mem::zeroed();
8989 = note: The never type (`!`) has no valid value
9090
9191error: the type `(i32, !)` does not permit being left uninitialized
92- --> $DIR/uninitialized-zeroed.rs:43 :30
92+ --> $DIR/uninitialized-zeroed.rs:44 :30
9393 |
9494LL | let _val: (i32, !) = mem::uninitialized();
9595 | ^^^^^^^^^^^^^^^^^^^^
@@ -100,7 +100,7 @@ LL | let _val: (i32, !) = mem::uninitialized();
100100 = note: The never type (`!`) has no valid value
101101
102102error: the type `Void` does not permit zero-initialization
103- --> $DIR/uninitialized-zeroed.rs:45 :26
103+ --> $DIR/uninitialized-zeroed.rs:46 :26
104104 |
105105LL | let _val: Void = mem::zeroed();
106106 | ^^^^^^^^^^^^^
@@ -111,7 +111,7 @@ LL | let _val: Void = mem::zeroed();
111111 = note: 0-variant enums have no valid value
112112
113113error: the type `Void` does not permit being left uninitialized
114- --> $DIR/uninitialized-zeroed.rs:46 :26
114+ --> $DIR/uninitialized-zeroed.rs:47 :26
115115 |
116116LL | let _val: Void = mem::uninitialized();
117117 | ^^^^^^^^^^^^^^^^^^^^
@@ -122,7 +122,7 @@ LL | let _val: Void = mem::uninitialized();
122122 = note: 0-variant enums have no valid value
123123
124124error: the type `&'static i32` does not permit zero-initialization
125- --> $DIR/uninitialized-zeroed.rs:48 :34
125+ --> $DIR/uninitialized-zeroed.rs:49 :34
126126 |
127127LL | let _val: &'static i32 = mem::zeroed();
128128 | ^^^^^^^^^^^^^
@@ -133,7 +133,7 @@ LL | let _val: &'static i32 = mem::zeroed();
133133 = note: References must be non-null
134134
135135error: the type `&'static i32` does not permit being left uninitialized
136- --> $DIR/uninitialized-zeroed.rs:49 :34
136+ --> $DIR/uninitialized-zeroed.rs:50 :34
137137 |
138138LL | let _val: &'static i32 = mem::uninitialized();
139139 | ^^^^^^^^^^^^^^^^^^^^
@@ -144,7 +144,7 @@ LL | let _val: &'static i32 = mem::uninitialized();
144144 = note: References must be non-null
145145
146146error: the type `Ref` does not permit zero-initialization
147- --> $DIR/uninitialized-zeroed.rs:51 :25
147+ --> $DIR/uninitialized-zeroed.rs:52 :25
148148 |
149149LL | let _val: Ref = mem::zeroed();
150150 | ^^^^^^^^^^^^^
@@ -153,13 +153,13 @@ LL | let _val: Ref = mem::zeroed();
153153 | help: use `MaybeUninit<T>` instead
154154 |
155155note: References must be non-null (in this struct field)
156- --> $DIR/uninitialized-zeroed.rs:14 :12
156+ --> $DIR/uninitialized-zeroed.rs:15 :12
157157 |
158158LL | struct Ref(&'static i32);
159159 | ^^^^^^^^^^^^
160160
161161error: the type `Ref` does not permit being left uninitialized
162- --> $DIR/uninitialized-zeroed.rs:52 :25
162+ --> $DIR/uninitialized-zeroed.rs:53 :25
163163 |
164164LL | let _val: Ref = mem::uninitialized();
165165 | ^^^^^^^^^^^^^^^^^^^^
@@ -168,13 +168,13 @@ LL | let _val: Ref = mem::uninitialized();
168168 | help: use `MaybeUninit<T>` instead
169169 |
170170note: References must be non-null (in this struct field)
171- --> $DIR/uninitialized-zeroed.rs:14 :12
171+ --> $DIR/uninitialized-zeroed.rs:15 :12
172172 |
173173LL | struct Ref(&'static i32);
174174 | ^^^^^^^^^^^^
175175
176176error: the type `fn()` does not permit zero-initialization
177- --> $DIR/uninitialized-zeroed.rs:54 :26
177+ --> $DIR/uninitialized-zeroed.rs:55 :26
178178 |
179179LL | let _val: fn() = mem::zeroed();
180180 | ^^^^^^^^^^^^^
@@ -185,7 +185,7 @@ LL | let _val: fn() = mem::zeroed();
185185 = note: Function pointers must be non-null
186186
187187error: the type `fn()` does not permit being left uninitialized
188- --> $DIR/uninitialized-zeroed.rs:55 :26
188+ --> $DIR/uninitialized-zeroed.rs:56 :26
189189 |
190190LL | let _val: fn() = mem::uninitialized();
191191 | ^^^^^^^^^^^^^^^^^^^^
@@ -196,7 +196,7 @@ LL | let _val: fn() = mem::uninitialized();
196196 = note: Function pointers must be non-null
197197
198198error: the type `Wrap<fn()>` does not permit zero-initialization
199- --> $DIR/uninitialized-zeroed.rs:57 :32
199+ --> $DIR/uninitialized-zeroed.rs:58 :32
200200 |
201201LL | let _val: Wrap<fn()> = mem::zeroed();
202202 | ^^^^^^^^^^^^^
@@ -205,13 +205,13 @@ LL | let _val: Wrap<fn()> = mem::zeroed();
205205 | help: use `MaybeUninit<T>` instead
206206 |
207207note: Function pointers must be non-null (in this struct field)
208- --> $DIR/uninitialized-zeroed.rs:17 :18
208+ --> $DIR/uninitialized-zeroed.rs:18 :18
209209 |
210210LL | struct Wrap<T> { wrapped: T }
211211 | ^^^^^^^^^^
212212
213213error: the type `Wrap<fn()>` does not permit being left uninitialized
214- --> $DIR/uninitialized-zeroed.rs:58 :32
214+ --> $DIR/uninitialized-zeroed.rs:59 :32
215215 |
216216LL | let _val: Wrap<fn()> = mem::uninitialized();
217217 | ^^^^^^^^^^^^^^^^^^^^
@@ -220,13 +220,13 @@ LL | let _val: Wrap<fn()> = mem::uninitialized();
220220 | help: use `MaybeUninit<T>` instead
221221 |
222222note: Function pointers must be non-null (in this struct field)
223- --> $DIR/uninitialized-zeroed.rs:17 :18
223+ --> $DIR/uninitialized-zeroed.rs:18 :18
224224 |
225225LL | struct Wrap<T> { wrapped: T }
226226 | ^^^^^^^^^^
227227
228228error: the type `WrapEnum<fn()>` does not permit zero-initialization
229- --> $DIR/uninitialized-zeroed.rs:60 :36
229+ --> $DIR/uninitialized-zeroed.rs:61 :36
230230 |
231231LL | let _val: WrapEnum<fn()> = mem::zeroed();
232232 | ^^^^^^^^^^^^^
@@ -235,13 +235,13 @@ LL | let _val: WrapEnum<fn()> = mem::zeroed();
235235 | help: use `MaybeUninit<T>` instead
236236 |
237237note: Function pointers must be non-null (in this enum field)
238- --> $DIR/uninitialized-zeroed.rs:18 :28
238+ --> $DIR/uninitialized-zeroed.rs:19 :28
239239 |
240240LL | enum WrapEnum<T> { Wrapped(T) }
241241 | ^
242242
243243error: the type `WrapEnum<fn()>` does not permit being left uninitialized
244- --> $DIR/uninitialized-zeroed.rs:61 :36
244+ --> $DIR/uninitialized-zeroed.rs:62 :36
245245 |
246246LL | let _val: WrapEnum<fn()> = mem::uninitialized();
247247 | ^^^^^^^^^^^^^^^^^^^^
@@ -250,13 +250,13 @@ LL | let _val: WrapEnum<fn()> = mem::uninitialized();
250250 | help: use `MaybeUninit<T>` instead
251251 |
252252note: Function pointers must be non-null (in this enum field)
253- --> $DIR/uninitialized-zeroed.rs:18 :28
253+ --> $DIR/uninitialized-zeroed.rs:19 :28
254254 |
255255LL | enum WrapEnum<T> { Wrapped(T) }
256256 | ^
257257
258258error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
259- --> $DIR/uninitialized-zeroed.rs:63 :42
259+ --> $DIR/uninitialized-zeroed.rs:64 :42
260260 |
261261LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
262262 | ^^^^^^^^^^^^^
@@ -265,13 +265,13 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed();
265265 | help: use `MaybeUninit<T>` instead
266266 |
267267note: References must be non-null (in this struct field)
268- --> $DIR/uninitialized-zeroed.rs:15 :16
268+ --> $DIR/uninitialized-zeroed.rs:16 :16
269269 |
270270LL | struct RefPair((&'static i32, i32));
271271 | ^^^^^^^^^^^^^^^^^^^
272272
273273error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized
274- --> $DIR/uninitialized-zeroed.rs:64 :42
274+ --> $DIR/uninitialized-zeroed.rs:65 :42
275275 |
276276LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
277277 | ^^^^^^^^^^^^^^^^^^^^
@@ -280,43 +280,35 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
280280 | help: use `MaybeUninit<T>` instead
281281 |
282282note: References must be non-null (in this struct field)
283- --> $DIR/uninitialized-zeroed.rs:15 :16
283+ --> $DIR/uninitialized-zeroed.rs:16 :16
284284 |
285285LL | struct RefPair((&'static i32, i32));
286286 | ^^^^^^^^^^^^^^^^^^^
287287
288- error: the type `std::vec::Vec<i32>` does not permit zero-initialization
289- --> $DIR/uninitialized-zeroed.rs:66:30
290- |
291- LL | let _val: Vec<i32> = mem::zeroed();
292- | ^^^^^^^^^^^^^
293- | |
294- | this code causes undefined behavior when executed
295- | help: use `MaybeUninit<T>` instead
288+ error: the type `std::ptr::NonNull<i32>` does not permit zero-initialization
289+ --> $DIR/uninitialized-zeroed.rs:67:34
296290 |
297- note: std::ptr::Unique<i32> must be non-null (in this struct field)
298- --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
291+ LL | let _val: NonNull<i32> = mem::zeroed();
292+ | ^^^^^^^^^^^^^
293+ | |
294+ | this code causes undefined behavior when executed
295+ | help: use `MaybeUninit<T>` instead
299296 |
300- LL | ptr: Unique<T>,
301- | ^^^^^^^^^^^^^^
297+ = note: std::ptr::NonNull<i32> must be non-null
302298
303- error: the type `std::vec::Vec<i32>` does not permit being left uninitialized
304- --> $DIR/uninitialized-zeroed.rs:67:30
305- |
306- LL | let _val: Vec<i32> = mem::uninitialized();
307- | ^^^^^^^^^^^^^^^^^^^^
308- | |
309- | this code causes undefined behavior when executed
310- | help: use `MaybeUninit<T>` instead
299+ error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
300+ --> $DIR/uninitialized-zeroed.rs:68:34
311301 |
312- note: std::ptr::Unique<i32> must be non-null (in this struct field)
313- --> $SRC_DIR/liballoc/raw_vec.rs:LL:COL
302+ LL | let _val: NonNull<i32> = mem::uninitialized();
303+ | ^^^^^^^^^^^^^^^^^^^^
304+ | |
305+ | this code causes undefined behavior when executed
306+ | help: use `MaybeUninit<T>` instead
314307 |
315- LL | ptr: Unique<T>,
316- | ^^^^^^^^^^^^^^
308+ = note: std::ptr::NonNull<i32> must be non-null
317309
318310error: the type `bool` does not permit being left uninitialized
319- --> $DIR/uninitialized-zeroed.rs:71 :26
311+ --> $DIR/uninitialized-zeroed.rs:72 :26
320312 |
321313LL | let _val: bool = mem::uninitialized();
322314 | ^^^^^^^^^^^^^^^^^^^^
@@ -327,7 +319,7 @@ LL | let _val: bool = mem::uninitialized();
327319 = note: Booleans must be `true` or `false`
328320
329321error: the type `Wrap<char>` does not permit being left uninitialized
330- --> $DIR/uninitialized-zeroed.rs:74 :32
322+ --> $DIR/uninitialized-zeroed.rs:75 :32
331323 |
332324LL | let _val: Wrap<char> = mem::uninitialized();
333325 | ^^^^^^^^^^^^^^^^^^^^
@@ -336,13 +328,13 @@ LL | let _val: Wrap<char> = mem::uninitialized();
336328 | help: use `MaybeUninit<T>` instead
337329 |
338330note: Characters must be a valid unicode codepoint (in this struct field)
339- --> $DIR/uninitialized-zeroed.rs:17 :18
331+ --> $DIR/uninitialized-zeroed.rs:18 :18
340332 |
341333LL | struct Wrap<T> { wrapped: T }
342334 | ^^^^^^^^^^
343335
344336error: the type `NonBig` does not permit being left uninitialized
345- --> $DIR/uninitialized-zeroed.rs:77 :28
337+ --> $DIR/uninitialized-zeroed.rs:78 :28
346338 |
347339LL | let _val: NonBig = mem::uninitialized();
348340 | ^^^^^^^^^^^^^^^^^^^^
@@ -353,7 +345,7 @@ LL | let _val: NonBig = mem::uninitialized();
353345 = note: NonBig must be initialized inside its custom valid range
354346
355347error: the type `&'static i32` does not permit zero-initialization
356- --> $DIR/uninitialized-zeroed.rs:80 :34
348+ --> $DIR/uninitialized-zeroed.rs:81 :34
357349 |
358350LL | let _val: &'static i32 = mem::transmute(0usize);
359351 | ^^^^^^^^^^^^^^^^^^^^^^
@@ -364,7 +356,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
364356 = note: References must be non-null
365357
366358error: the type `&'static [i32]` does not permit zero-initialization
367- --> $DIR/uninitialized-zeroed.rs:81 :36
359+ --> $DIR/uninitialized-zeroed.rs:82 :36
368360 |
369361LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
370362 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -375,7 +367,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
375367 = note: References must be non-null
376368
377369error: the type `std::num::NonZeroU32` does not permit zero-initialization
378- --> $DIR/uninitialized-zeroed.rs:82 :32
370+ --> $DIR/uninitialized-zeroed.rs:83 :32
379371 |
380372LL | let _val: NonZeroU32 = mem::transmute(0);
381373 | ^^^^^^^^^^^^^^^^^
0 commit comments