@@ -104,6 +104,32 @@ fn main() {
104104 "attempted to instantiate uninhabited type `Bar`"
105105 ) ;
106106
107+ test_panic_msg (
108+ || mem:: uninitialized :: < [ Foo ; 2 ] > ( ) ,
109+ "attempted to instantiate uninhabited type `[Foo; 2]`"
110+ ) ;
111+ test_panic_msg (
112+ || mem:: zeroed :: < [ Foo ; 2 ] > ( ) ,
113+ "attempted to instantiate uninhabited type `[Foo; 2]`"
114+ ) ;
115+ test_panic_msg (
116+ || MaybeUninit :: < [ Foo ; 2 ] > :: uninit ( ) . assume_init ( ) ,
117+ "attempted to instantiate uninhabited type `[Foo; 2]`"
118+ ) ;
119+
120+ test_panic_msg (
121+ || mem:: uninitialized :: < [ Bar ; 2 ] > ( ) ,
122+ "attempted to instantiate uninhabited type `[Bar; 2]`"
123+ ) ;
124+ test_panic_msg (
125+ || mem:: zeroed :: < [ Bar ; 2 ] > ( ) ,
126+ "attempted to instantiate uninhabited type `[Bar; 2]`"
127+ ) ;
128+ test_panic_msg (
129+ || MaybeUninit :: < [ Bar ; 2 ] > :: uninit ( ) . assume_init ( ) ,
130+ "attempted to instantiate uninhabited type `[Bar; 2]`"
131+ ) ;
132+
107133 // Types that do not like zero-initialziation
108134 test_panic_msg (
109135 || mem:: uninitialized :: < fn ( ) > ( ) ,
@@ -199,7 +225,9 @@ fn main() {
199225 let _val = mem:: zeroed :: < OneVariant > ( ) ;
200226 let _val = mem:: zeroed :: < Option < & ' static i32 > > ( ) ;
201227 let _val = mem:: zeroed :: < MaybeUninit < NonNull < u32 > > > ( ) ;
228+ let _val = mem:: zeroed :: < [ !; 0 ] > ( ) ;
202229 let _val = mem:: uninitialized :: < MaybeUninit < bool > > ( ) ;
230+ let _val = mem:: uninitialized :: < [ !; 0 ] > ( ) ;
203231
204232 // These are UB because they have not been officially blessed, but we await the resolution
205233 // of <https://github.com/rust-lang/unsafe-code-guidelines/issues/71> before doing
0 commit comments