@@ -34,6 +34,7 @@ LL | let _val: Wrap<&'static T> = mem::zeroed();
3434 | this code causes undefined behavior when executed
3535 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
3636 |
37+ = note: `Wrap<&T>` must be non-null
3738note: in this struct field
3839 --> $DIR/invalid_value.rs:17:18
3940 |
@@ -50,6 +51,7 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized();
5051 | this code causes undefined behavior when executed
5152 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
5253 |
54+ = note: `Wrap<&T>` must be non-null
5355note: in this struct field
5456 --> $DIR/invalid_value.rs:17:18
5557 |
@@ -162,6 +164,7 @@ LL | let _val: Ref = mem::zeroed();
162164 | this code causes undefined behavior when executed
163165 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
164166 |
167+ = note: `Ref` must be non-null
165168note: in this struct field
166169 --> $DIR/invalid_value.rs:14:12
167170 |
@@ -178,6 +181,7 @@ LL | let _val: Ref = mem::uninitialized();
178181 | this code causes undefined behavior when executed
179182 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
180183 |
184+ = note: `Ref` must be non-null
181185note: in this struct field
182186 --> $DIR/invalid_value.rs:14:12
183187 |
@@ -216,6 +220,7 @@ LL | let _val: Wrap<fn()> = mem::zeroed();
216220 | this code causes undefined behavior when executed
217221 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
218222 |
223+ = note: `Wrap<fn()>` must be non-null
219224note: in this struct field
220225 --> $DIR/invalid_value.rs:17:18
221226 |
@@ -232,6 +237,7 @@ LL | let _val: Wrap<fn()> = mem::uninitialized();
232237 | this code causes undefined behavior when executed
233238 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
234239 |
240+ = note: `Wrap<fn()>` must be non-null
235241note: in this struct field
236242 --> $DIR/invalid_value.rs:17:18
237243 |
@@ -248,6 +254,7 @@ LL | let _val: WrapEnum<fn()> = mem::zeroed();
248254 | this code causes undefined behavior when executed
249255 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
250256 |
257+ = note: `WrapEnum<fn()>` must be non-null
251258note: in this field of the only potentially inhabited enum variant
252259 --> $DIR/invalid_value.rs:18:28
253260 |
@@ -264,6 +271,7 @@ LL | let _val: WrapEnum<fn()> = mem::uninitialized();
264271 | this code causes undefined behavior when executed
265272 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
266273 |
274+ = note: `WrapEnum<fn()>` must be non-null
267275note: in this field of the only potentially inhabited enum variant
268276 --> $DIR/invalid_value.rs:18:28
269277 |
@@ -285,6 +293,7 @@ note: in this struct field
285293 |
286294LL | struct Wrap<T> { wrapped: T }
287295 | ^^^^^^^^^^
296+ = note: `RefPair` must be non-null
288297note: in this struct field
289298 --> $DIR/invalid_value.rs:15:16
290299 |
@@ -306,6 +315,7 @@ note: in this struct field
306315 |
307316LL | struct Wrap<T> { wrapped: T }
308317 | ^^^^^^^^^^
318+ = note: `RefPair` must be non-null
309319note: in this struct field
310320 --> $DIR/invalid_value.rs:15:16
311321 |
@@ -334,6 +344,12 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
334344 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
335345 |
336346 = note: `std::ptr::NonNull<i32>` must be non-null
347+ note: in this struct field
348+ --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
349+ |
350+ LL | pointer: *const T,
351+ | ^^^^^^^^^^^^^^^^^
352+ = note: raw pointers must not be uninitialized
337353
338354error: the type `(NonZeroU32, i32)` does not permit zero-initialization
339355 --> $DIR/invalid_value.rs:95:39
@@ -356,6 +372,19 @@ LL | let _val: (NonZeroU32, i32) = mem::uninitialized();
356372 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
357373 |
358374 = note: `std::num::NonZeroU32` must be non-null
375+ note: in this struct field
376+ --> $SRC_DIR/core/src/num/nonzero.rs:LL:COL
377+ |
378+ LL | / nonzero_integers! {
379+ LL | | #[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
380+ LL | | #[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
381+ LL | | #[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
382+ ... |
383+ LL | | #[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIs...
384+ LL | | }
385+ | |_^
386+ = note: integers must not be uninitialized
387+ = note: this error originates in the macro `nonzero_integers` (in Nightly builds, run with -Z macro-backtrace for more info)
359388
360389error: the type `*const dyn Send` does not permit zero-initialization
361390 --> $DIR/invalid_value.rs:98:37
@@ -440,6 +469,7 @@ LL | let _val: OneFruitNonZero = mem::zeroed();
440469 | this code causes undefined behavior when executed
441470 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
442471 |
472+ = note: `OneFruitNonZero` must be non-null
443473note: in this field of the only potentially inhabited enum variant
444474 --> $DIR/invalid_value.rs:39:12
445475 |
@@ -456,12 +486,26 @@ LL | let _val: OneFruitNonZero = mem::uninitialized();
456486 | this code causes undefined behavior when executed
457487 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
458488 |
489+ = note: `OneFruitNonZero` must be non-null
459490note: in this field of the only potentially inhabited enum variant
460491 --> $DIR/invalid_value.rs:39:12
461492 |
462493LL | Banana(NonZeroU32),
463494 | ^^^^^^^^^^
464495 = note: `std::num::NonZeroU32` must be non-null
496+ note: in this struct field
497+ --> $SRC_DIR/core/src/num/nonzero.rs:LL:COL
498+ |
499+ LL | / nonzero_integers! {
500+ LL | | #[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8);
501+ LL | | #[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16);
502+ LL | | #[stable(feature = "nonzero", since = "1.28.0")] #[rustc_const_stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32);
503+ ... |
504+ LL | | #[stable(feature = "signed_nonzero", since = "1.34.0")] #[rustc_const_stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIs...
505+ LL | | }
506+ | |_^
507+ = note: integers must not be uninitialized
508+ = note: this error originates in the macro `nonzero_integers` (in Nightly builds, run with -Z macro-backtrace for more info)
465509
466510error: the type `bool` does not permit being left uninitialized
467511 --> $DIR/invalid_value.rs:112:26
@@ -483,6 +527,7 @@ LL | let _val: Wrap<char> = mem::uninitialized();
483527 | this code causes undefined behavior when executed
484528 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
485529 |
530+ = note: `Wrap<char>` must be initialized inside its custom valid range
486531note: in this struct field
487532 --> $DIR/invalid_value.rs:17:18
488533 |
@@ -500,6 +545,12 @@ LL | let _val: NonBig = mem::uninitialized();
500545 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
501546 |
502547 = note: `NonBig` must be initialized inside its custom valid range
548+ note: in this struct field
549+ --> $DIR/invalid_value.rs:23:26
550+ |
551+ LL | pub(crate) struct NonBig(u64);
552+ | ^^^
553+ = note: integers must not be uninitialized
503554
504555error: the type `Fruit` does not permit being left uninitialized
505556 --> $DIR/invalid_value.rs:121:27
@@ -581,6 +632,12 @@ LL | let _val: WrapAroundRange = mem::uninitialized();
581632 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
582633 |
583634 = note: `WrapAroundRange` must be initialized inside its custom valid range
635+ note: in this struct field
636+ --> $DIR/invalid_value.rs:49:35
637+ |
638+ LL | pub(crate) struct WrapAroundRange(u8);
639+ | ^^
640+ = note: integers must not be uninitialized
584641
585642error: the type `Result<i32, i32>` does not permit being left uninitialized
586643 --> $DIR/invalid_value.rs:144:38
@@ -651,6 +708,12 @@ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
651708 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
652709 |
653710 = note: `std::ptr::NonNull<i32>` must be non-null
711+ note: in this struct field
712+ --> $SRC_DIR/core/src/ptr/non_null.rs:LL:COL
713+ |
714+ LL | pointer: *const T,
715+ | ^^^^^^^^^^^^^^^^^
716+ = note: raw pointers must not be uninitialized
654717
655718error: the type `bool` does not permit being left uninitialized
656719 --> $DIR/invalid_value.rs:159:26
0 commit comments