@@ -307,8 +307,30 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
307307 |
308308 = note: std::ptr::NonNull<i32> must be non-null
309309
310+ error: the type `*const dyn std::marker::Send` does not permit zero-initialization
311+ --> $DIR/uninitialized-zeroed.rs:70:37
312+ |
313+ LL | let _val: *const dyn Send = mem::zeroed();
314+ | ^^^^^^^^^^^^^
315+ | |
316+ | this code causes undefined behavior when executed
317+ | help: use `MaybeUninit<T>` instead
318+ |
319+ = note: The vtable of a wide raw pointer must be non-null
320+
321+ error: the type `*const dyn std::marker::Send` does not permit being left uninitialized
322+ --> $DIR/uninitialized-zeroed.rs:71:37
323+ |
324+ LL | let _val: *const dyn Send = mem::uninitialized();
325+ | ^^^^^^^^^^^^^^^^^^^^
326+ | |
327+ | this code causes undefined behavior when executed
328+ | help: use `MaybeUninit<T>` instead
329+ |
330+ = note: The vtable of a wide raw pointer must be non-null
331+
310332error: the type `bool` does not permit being left uninitialized
311- --> $DIR/uninitialized-zeroed.rs:72 :26
333+ --> $DIR/uninitialized-zeroed.rs:75 :26
312334 |
313335LL | let _val: bool = mem::uninitialized();
314336 | ^^^^^^^^^^^^^^^^^^^^
@@ -319,7 +341,7 @@ LL | let _val: bool = mem::uninitialized();
319341 = note: Booleans must be `true` or `false`
320342
321343error: the type `Wrap<char>` does not permit being left uninitialized
322- --> $DIR/uninitialized-zeroed.rs:75 :32
344+ --> $DIR/uninitialized-zeroed.rs:78 :32
323345 |
324346LL | let _val: Wrap<char> = mem::uninitialized();
325347 | ^^^^^^^^^^^^^^^^^^^^
@@ -334,7 +356,7 @@ LL | struct Wrap<T> { wrapped: T }
334356 | ^^^^^^^^^^
335357
336358error: the type `NonBig` does not permit being left uninitialized
337- --> $DIR/uninitialized-zeroed.rs:78 :28
359+ --> $DIR/uninitialized-zeroed.rs:81 :28
338360 |
339361LL | let _val: NonBig = mem::uninitialized();
340362 | ^^^^^^^^^^^^^^^^^^^^
@@ -345,7 +367,7 @@ LL | let _val: NonBig = mem::uninitialized();
345367 = note: NonBig must be initialized inside its custom valid range
346368
347369error: the type `&'static i32` does not permit zero-initialization
348- --> $DIR/uninitialized-zeroed.rs:81 :34
370+ --> $DIR/uninitialized-zeroed.rs:84 :34
349371 |
350372LL | let _val: &'static i32 = mem::transmute(0usize);
351373 | ^^^^^^^^^^^^^^^^^^^^^^
@@ -356,7 +378,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
356378 = note: References must be non-null
357379
358380error: the type `&'static [i32]` does not permit zero-initialization
359- --> $DIR/uninitialized-zeroed.rs:82 :36
381+ --> $DIR/uninitialized-zeroed.rs:85 :36
360382 |
361383LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
362384 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -367,7 +389,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
367389 = note: References must be non-null
368390
369391error: the type `std::num::NonZeroU32` does not permit zero-initialization
370- --> $DIR/uninitialized-zeroed.rs:83 :32
392+ --> $DIR/uninitialized-zeroed.rs:86 :32
371393 |
372394LL | let _val: NonZeroU32 = mem::transmute(0);
373395 | ^^^^^^^^^^^^^^^^^
@@ -377,5 +399,38 @@ LL | let _val: NonZeroU32 = mem::transmute(0);
377399 |
378400 = note: std::num::NonZeroU32 must be non-null
379401
380- error: aborting due to 30 previous errors
402+ error: the type `std::ptr::NonNull<i32>` does not permit zero-initialization
403+ --> $DIR/uninitialized-zeroed.rs:89:34
404+ |
405+ LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
406+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
407+ | |
408+ | this code causes undefined behavior when executed
409+ | help: use `MaybeUninit<T>` instead
410+ |
411+ = note: std::ptr::NonNull<i32> must be non-null
412+
413+ error: the type `std::ptr::NonNull<i32>` does not permit being left uninitialized
414+ --> $DIR/uninitialized-zeroed.rs:90:34
415+ |
416+ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
417+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
418+ | |
419+ | this code causes undefined behavior when executed
420+ | help: use `MaybeUninit<T>` instead
421+ |
422+ = note: std::ptr::NonNull<i32> must be non-null
423+
424+ error: the type `bool` does not permit being left uninitialized
425+ --> $DIR/uninitialized-zeroed.rs:91:26
426+ |
427+ LL | let _val: bool = MaybeUninit::uninit().assume_init();
428+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
429+ | |
430+ | this code causes undefined behavior when executed
431+ | help: use `MaybeUninit<T>` instead
432+ |
433+ = note: Booleans must be `true` or `false`
434+
435+ error: aborting due to 35 previous errors
381436
0 commit comments