@@ -284,25 +284,23 @@ fn main() {
284284 "attempted to leave type `[core::ptr::non_null::NonNull<()>; 1]` uninitialized, which is invalid"
285285 ) ;
286286
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"
290290 ) ;
291291
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"
295295 ) ;
296296
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"
301300 ) ;
302-
303301 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"
306304 ) ;
307305
308306 // Some things that should work.
@@ -339,19 +337,36 @@ fn main() {
339337 "attempted to leave type `[i32; 1]` uninitialized, which is invalid"
340338 ) ;
341339
340+ // These are UB, but making them panic breaks too many crates at the moment.
342341 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"
345344 ) ;
346345
347346 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"
350349 ) ;
351350
352351 test_strict_panic_msg (
353352 || mem:: zeroed :: < [ NonNull < ( ) > ; 1 ] > ( ) ,
354353 "attempted to zero-initialize type `[core::ptr::non_null::NonNull<()>; 1]`, which is invalid"
355354 ) ;
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+ ) ;
356371 }
357372}
0 commit comments