@@ -97,7 +97,7 @@ LL | let _val: (i32, !) = mem::uninitialized();
9797 | this code causes undefined behavior when executed
9898 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
9999 |
100- = note: the `!` type has no valid value
100+ = note: integers must not be uninitialized
101101
102102error: the type `Void` does not permit zero-initialization
103103 --> $DIR/uninitialized-zeroed.rs:57:26
@@ -414,8 +414,52 @@ LL | let _val: [bool; 2] = mem::uninitialized();
414414 |
415415 = note: booleans must be either `true` or `false`
416416
417+ error: the type `i32` does not permit being left uninitialized
418+ --> $DIR/uninitialized-zeroed.rs:104:25
419+ |
420+ LL | let _val: i32 = mem::uninitialized();
421+ | ^^^^^^^^^^^^^^^^^^^^
422+ | |
423+ | this code causes undefined behavior when executed
424+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
425+ |
426+ = note: integers must not be uninitialized
427+
428+ error: the type `f32` does not permit being left uninitialized
429+ --> $DIR/uninitialized-zeroed.rs:107:25
430+ |
431+ LL | let _val: f32 = mem::uninitialized();
432+ | ^^^^^^^^^^^^^^^^^^^^
433+ | |
434+ | this code causes undefined behavior when executed
435+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
436+ |
437+ = note: floats must not be uninitialized
438+
439+ error: the type `*const ()` does not permit being left uninitialized
440+ --> $DIR/uninitialized-zeroed.rs:110:31
441+ |
442+ LL | let _val: *const () = mem::uninitialized();
443+ | ^^^^^^^^^^^^^^^^^^^^
444+ | |
445+ | this code causes undefined behavior when executed
446+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
447+ |
448+ = note: raw pointers must not be uninitialized
449+
450+ error: the type `*const [()]` does not permit being left uninitialized
451+ --> $DIR/uninitialized-zeroed.rs:113:33
452+ |
453+ LL | let _val: *const [()] = mem::uninitialized();
454+ | ^^^^^^^^^^^^^^^^^^^^
455+ | |
456+ | this code causes undefined behavior when executed
457+ | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
458+ |
459+ = note: raw pointers must not be uninitialized
460+
417461error: the type `&i32` does not permit zero-initialization
418- --> $DIR/uninitialized-zeroed.rs:104 :34
462+ --> $DIR/uninitialized-zeroed.rs:116 :34
419463 |
420464LL | let _val: &'static i32 = mem::transmute(0usize);
421465 | ^^^^^^^^^^^^^^^^^^^^^^
@@ -426,7 +470,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
426470 = note: references must be non-null
427471
428472error: the type `&[i32]` does not permit zero-initialization
429- --> $DIR/uninitialized-zeroed.rs:105 :36
473+ --> $DIR/uninitialized-zeroed.rs:117 :36
430474 |
431475LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
432476 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -437,7 +481,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
437481 = note: references must be non-null
438482
439483error: the type `NonZeroU32` does not permit zero-initialization
440- --> $DIR/uninitialized-zeroed.rs:106 :32
484+ --> $DIR/uninitialized-zeroed.rs:118 :32
441485 |
442486LL | let _val: NonZeroU32 = mem::transmute(0);
443487 | ^^^^^^^^^^^^^^^^^
@@ -448,7 +492,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0);
448492 = note: `std::num::NonZeroU32` must be non-null
449493
450494error: the type `NonNull<i32>` does not permit zero-initialization
451- --> $DIR/uninitialized-zeroed.rs:109 :34
495+ --> $DIR/uninitialized-zeroed.rs:121 :34
452496 |
453497LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
454498 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -459,7 +503,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
459503 = note: `std::ptr::NonNull<i32>` must be non-null
460504
461505error: the type `NonNull<i32>` does not permit being left uninitialized
462- --> $DIR/uninitialized-zeroed.rs:110 :34
506+ --> $DIR/uninitialized-zeroed.rs:122 :34
463507 |
464508LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
465509 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -470,7 +514,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
470514 = note: `std::ptr::NonNull<i32>` must be non-null
471515
472516error: the type `bool` does not permit being left uninitialized
473- --> $DIR/uninitialized-zeroed.rs:111 :26
517+ --> $DIR/uninitialized-zeroed.rs:123 :26
474518 |
475519LL | let _val: bool = MaybeUninit::uninit().assume_init();
476520 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -480,5 +524,5 @@ LL | let _val: bool = MaybeUninit::uninit().assume_init();
480524 |
481525 = note: booleans must be either `true` or `false`
482526
483- error: aborting due to 39 previous errors
527+ error: aborting due to 43 previous errors
484528
0 commit comments