@@ -34,6 +34,7 @@ LL | let _val: Wrap<&'static T> = mem::zeroed();
34
34
| this code causes undefined behavior when executed
35
35
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
36
36
|
37
+ = note: `Wrap<&T>` must be non-null
37
38
note: in this struct field
38
39
--> $DIR/invalid_value.rs:17:18
39
40
|
@@ -50,6 +51,7 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized();
50
51
| this code causes undefined behavior when executed
51
52
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
52
53
|
54
+ = note: `Wrap<&T>` must be non-null
53
55
note: in this struct field
54
56
--> $DIR/invalid_value.rs:17:18
55
57
|
@@ -162,6 +164,7 @@ LL | let _val: Ref = mem::zeroed();
162
164
| this code causes undefined behavior when executed
163
165
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
164
166
|
167
+ = note: `Ref` must be non-null
165
168
note: in this struct field
166
169
--> $DIR/invalid_value.rs:14:12
167
170
|
@@ -178,6 +181,7 @@ LL | let _val: Ref = mem::uninitialized();
178
181
| this code causes undefined behavior when executed
179
182
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
180
183
|
184
+ = note: `Ref` must be non-null
181
185
note: in this struct field
182
186
--> $DIR/invalid_value.rs:14:12
183
187
|
@@ -216,6 +220,7 @@ LL | let _val: Wrap<fn()> = mem::zeroed();
216
220
| this code causes undefined behavior when executed
217
221
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
218
222
|
223
+ = note: `Wrap<fn()>` must be non-null
219
224
note: in this struct field
220
225
--> $DIR/invalid_value.rs:17:18
221
226
|
@@ -232,6 +237,7 @@ LL | let _val: Wrap<fn()> = mem::uninitialized();
232
237
| this code causes undefined behavior when executed
233
238
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
234
239
|
240
+ = note: `Wrap<fn()>` must be non-null
235
241
note: in this struct field
236
242
--> $DIR/invalid_value.rs:17:18
237
243
|
@@ -248,6 +254,7 @@ LL | let _val: WrapEnum<fn()> = mem::zeroed();
248
254
| this code causes undefined behavior when executed
249
255
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
250
256
|
257
+ = note: `WrapEnum<fn()>` must be non-null
251
258
note: in this field of the only potentially inhabited enum variant
252
259
--> $DIR/invalid_value.rs:18:28
253
260
|
@@ -264,6 +271,7 @@ LL | let _val: WrapEnum<fn()> = mem::uninitialized();
264
271
| this code causes undefined behavior when executed
265
272
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
266
273
|
274
+ = note: `WrapEnum<fn()>` must be non-null
267
275
note: in this field of the only potentially inhabited enum variant
268
276
--> $DIR/invalid_value.rs:18:28
269
277
|
@@ -285,6 +293,7 @@ note: in this struct field
285
293
|
286
294
LL | struct Wrap<T> { wrapped: T }
287
295
| ^^^^^^^^^^
296
+ = note: `RefPair` must be non-null
288
297
note: in this struct field
289
298
--> $DIR/invalid_value.rs:15:16
290
299
|
@@ -306,6 +315,7 @@ note: in this struct field
306
315
|
307
316
LL | struct Wrap<T> { wrapped: T }
308
317
| ^^^^^^^^^^
318
+ = note: `RefPair` must be non-null
309
319
note: in this struct field
310
320
--> $DIR/invalid_value.rs:15:16
311
321
|
@@ -334,6 +344,12 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
334
344
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
335
345
|
336
346
= 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
337
353
338
354
error: the type `(NonZeroU32, i32)` does not permit zero-initialization
339
355
--> $DIR/invalid_value.rs:95:39
@@ -356,6 +372,19 @@ LL | let _val: (NonZeroU32, i32) = mem::uninitialized();
356
372
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
357
373
|
358
374
= 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)
359
388
360
389
error: the type `*const dyn Send` does not permit zero-initialization
361
390
--> $DIR/invalid_value.rs:98:37
@@ -440,6 +469,7 @@ LL | let _val: OneFruitNonZero = mem::zeroed();
440
469
| this code causes undefined behavior when executed
441
470
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
442
471
|
472
+ = note: `OneFruitNonZero` must be non-null
443
473
note: in this field of the only potentially inhabited enum variant
444
474
--> $DIR/invalid_value.rs:39:12
445
475
|
@@ -456,12 +486,26 @@ LL | let _val: OneFruitNonZero = mem::uninitialized();
456
486
| this code causes undefined behavior when executed
457
487
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
458
488
|
489
+ = note: `OneFruitNonZero` must be non-null
459
490
note: in this field of the only potentially inhabited enum variant
460
491
--> $DIR/invalid_value.rs:39:12
461
492
|
462
493
LL | Banana(NonZeroU32),
463
494
| ^^^^^^^^^^
464
495
= 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)
465
509
466
510
error: the type `bool` does not permit being left uninitialized
467
511
--> $DIR/invalid_value.rs:112:26
@@ -483,6 +527,7 @@ LL | let _val: Wrap<char> = mem::uninitialized();
483
527
| this code causes undefined behavior when executed
484
528
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
485
529
|
530
+ = note: `Wrap<char>` must be initialized inside its custom valid range
486
531
note: in this struct field
487
532
--> $DIR/invalid_value.rs:17:18
488
533
|
@@ -500,6 +545,12 @@ LL | let _val: NonBig = mem::uninitialized();
500
545
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
501
546
|
502
547
= 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
503
554
504
555
error: the type `Fruit` does not permit being left uninitialized
505
556
--> $DIR/invalid_value.rs:121:27
@@ -581,6 +632,12 @@ LL | let _val: WrapAroundRange = mem::uninitialized();
581
632
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
582
633
|
583
634
= 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
584
641
585
642
error: the type `Result<i32, i32>` does not permit being left uninitialized
586
643
--> $DIR/invalid_value.rs:144:38
@@ -651,6 +708,12 @@ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
651
708
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
652
709
|
653
710
= 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
654
717
655
718
error: the type `bool` does not permit being left uninitialized
656
719
--> $DIR/invalid_value.rs:159:26
0 commit comments