@@ -284,25 +284,23 @@ fn main() {
284
284
"attempted to leave type `[core::ptr::non_null::NonNull<()>; 1]` uninitialized, which is invalid"
285
285
) ;
286
286
287
- test_strict_panic_msg (
288
- || mem:: zeroed :: < LR_NonZero > ( ) ,
289
- "attempted to zero-initialize type `LR_NonZero` , which is invalid"
287
+ test_panic_msg (
288
+ || mem:: uninitialized :: < ( & [ u8 ] , & str , & ( ) ) > ( ) ,
289
+ "attempted to leave type `(&[u8], &str, &())` uninitialized , which is invalid"
290
290
) ;
291
291
292
- test_strict_panic_msg (
293
- || mem:: zeroed :: < [ LR_NonZero ; 1 ] > ( ) ,
294
- "attempted to zero-initialize type `[LR_NonZero ; 1]`, which is invalid"
292
+ test_panic_msg (
293
+ || mem:: uninitialized :: < [ & ( ) ; 1 ] > ( ) ,
294
+ "attempted to leave type `[&() ; 1]` uninitialized , which is invalid"
295
295
) ;
296
296
297
- test_strict_panic_msg (
298
- || mem:: zeroed :: < ManuallyDrop < LR_NonZero > > ( ) ,
299
- "attempted to zero-initialize type `core::mem::manually_drop::ManuallyDrop<LR_NonZero>`, \
300
- which is invalid"
297
+ test_panic_msg (
298
+ || mem:: uninitialized :: < [ & dyn Send ; 1 ] > ( ) ,
299
+ "attempted to leave type `[&dyn core::marker::Send; 1]` uninitialized, which is invalid"
301
300
) ;
302
-
303
301
test_panic_msg (
304
- || mem:: uninitialized :: < ( & ' static [ u8 ] , & ' static str ) > ( ) ,
305
- "attempted to leave type `(&[u8], &str) ` uninitialized, which is invalid"
302
+ || mem:: uninitialized :: < [ * const dyn Send ; 1 ] > ( ) ,
303
+ "attempted to leave type `[*const dyn core::marker::Send; 1] ` uninitialized, which is invalid"
306
304
) ;
307
305
308
306
// Some things that should work.
@@ -339,19 +337,36 @@ fn main() {
339
337
"attempted to leave type `[i32; 1]` uninitialized, which is invalid"
340
338
) ;
341
339
340
+ // These are UB, but making them panic breaks too many crates at the moment.
342
341
test_strict_panic_msg (
343
- || mem:: uninitialized :: < [ ( & ' static [ u8 ] , & ' static str , & ( ) ) ; 1 ] > ( ) ,
344
- "attempted to leave type `[(&[u8], &str, &()) ; 1]` uninitialized , which is invalid"
342
+ || mem:: zeroed :: < [ ( & [ u8 ] , & str ) ; 1 ] > ( ) ,
343
+ "attempted to zero-initialize type `[(&[u8], &str) ; 1]`, which is invalid"
345
344
) ;
346
345
347
346
test_strict_panic_msg (
348
- || mem:: zeroed :: < [ ( & ' static [ u8 ] , & ' static str ) ; 1 ] > ( ) ,
349
- "attempted to zero-initialize type `[(&[u8], &str); 1]`, which is invalid"
347
+ || mem:: uninitialized :: < [ ( & [ u8 ] , & str ) ; 1 ] > ( ) ,
348
+ "attempted to leave type `[(&[u8], &str); 1]` uninitialized , which is invalid"
350
349
) ;
351
350
352
351
test_strict_panic_msg (
353
352
|| mem:: zeroed :: < [ NonNull < ( ) > ; 1 ] > ( ) ,
354
353
"attempted to zero-initialize type `[core::ptr::non_null::NonNull<()>; 1]`, which is invalid"
355
354
) ;
355
+
356
+ test_strict_panic_msg (
357
+ || mem:: zeroed :: < LR_NonZero > ( ) ,
358
+ "attempted to zero-initialize type `LR_NonZero`, which is invalid"
359
+ ) ;
360
+
361
+ test_strict_panic_msg (
362
+ || mem:: zeroed :: < [ LR_NonZero ; 1 ] > ( ) ,
363
+ "attempted to zero-initialize type `[LR_NonZero; 1]`, which is invalid"
364
+ ) ;
365
+
366
+ test_strict_panic_msg (
367
+ || mem:: zeroed :: < ManuallyDrop < LR_NonZero > > ( ) ,
368
+ "attempted to zero-initialize type `core::mem::manually_drop::ManuallyDrop<LR_NonZero>`, \
369
+ which is invalid"
370
+ ) ;
356
371
}
357
372
}
0 commit comments