@@ -104,6 +104,32 @@ fn main() {
104
104
"attempted to instantiate uninhabited type `Bar`"
105
105
) ;
106
106
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
+
107
133
// Types that do not like zero-initialziation
108
134
test_panic_msg (
109
135
|| mem:: uninitialized :: < fn ( ) > ( ) ,
@@ -199,7 +225,9 @@ fn main() {
199
225
let _val = mem:: zeroed :: < OneVariant > ( ) ;
200
226
let _val = mem:: zeroed :: < Option < & ' static i32 > > ( ) ;
201
227
let _val = mem:: zeroed :: < MaybeUninit < NonNull < u32 > > > ( ) ;
228
+ let _val = mem:: zeroed :: < [ !; 0 ] > ( ) ;
202
229
let _val = mem:: uninitialized :: < MaybeUninit < bool > > ( ) ;
230
+ let _val = mem:: uninitialized :: < [ !; 0 ] > ( ) ;
203
231
204
232
// These are UB because they have not been officially blessed, but we await the resolution
205
233
// of <https://github.com/rust-lang/unsafe-code-guidelines/issues/71> before doing
0 commit comments