@@ -307,8 +307,30 @@ LL | let _val: NonNull<i32> = mem::uninitialized();
307
307
|
308
308
= note: std::ptr::NonNull<i32> must be non-null
309
309
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
+
310
332
error: the type `bool` does not permit being left uninitialized
311
- --> $DIR/uninitialized-zeroed.rs:72 :26
333
+ --> $DIR/uninitialized-zeroed.rs:75 :26
312
334
|
313
335
LL | let _val: bool = mem::uninitialized();
314
336
| ^^^^^^^^^^^^^^^^^^^^
@@ -319,7 +341,7 @@ LL | let _val: bool = mem::uninitialized();
319
341
= note: Booleans must be `true` or `false`
320
342
321
343
error: the type `Wrap<char>` does not permit being left uninitialized
322
- --> $DIR/uninitialized-zeroed.rs:75 :32
344
+ --> $DIR/uninitialized-zeroed.rs:78 :32
323
345
|
324
346
LL | let _val: Wrap<char> = mem::uninitialized();
325
347
| ^^^^^^^^^^^^^^^^^^^^
@@ -334,7 +356,7 @@ LL | struct Wrap<T> { wrapped: T }
334
356
| ^^^^^^^^^^
335
357
336
358
error: the type `NonBig` does not permit being left uninitialized
337
- --> $DIR/uninitialized-zeroed.rs:78 :28
359
+ --> $DIR/uninitialized-zeroed.rs:81 :28
338
360
|
339
361
LL | let _val: NonBig = mem::uninitialized();
340
362
| ^^^^^^^^^^^^^^^^^^^^
@@ -345,7 +367,7 @@ LL | let _val: NonBig = mem::uninitialized();
345
367
= note: NonBig must be initialized inside its custom valid range
346
368
347
369
error: the type `&'static i32` does not permit zero-initialization
348
- --> $DIR/uninitialized-zeroed.rs:81 :34
370
+ --> $DIR/uninitialized-zeroed.rs:84 :34
349
371
|
350
372
LL | let _val: &'static i32 = mem::transmute(0usize);
351
373
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -356,7 +378,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize);
356
378
= note: References must be non-null
357
379
358
380
error: the type `&'static [i32]` does not permit zero-initialization
359
- --> $DIR/uninitialized-zeroed.rs:82 :36
381
+ --> $DIR/uninitialized-zeroed.rs:85 :36
360
382
|
361
383
LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
362
384
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -367,7 +389,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize));
367
389
= note: References must be non-null
368
390
369
391
error: the type `std::num::NonZeroU32` does not permit zero-initialization
370
- --> $DIR/uninitialized-zeroed.rs:83 :32
392
+ --> $DIR/uninitialized-zeroed.rs:86 :32
371
393
|
372
394
LL | let _val: NonZeroU32 = mem::transmute(0);
373
395
| ^^^^^^^^^^^^^^^^^
@@ -377,5 +399,38 @@ LL | let _val: NonZeroU32 = mem::transmute(0);
377
399
|
378
400
= note: std::num::NonZeroU32 must be non-null
379
401
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
381
436
0 commit comments