@@ -66,20 +66,20 @@ fn main() {
6666 "attempted to instantiate uninhabited type `!`"
6767 ) ;
6868 test_panic_msg (
69- || mem:: uninitialized :: < [ ! ; 2 ] > ( ) ,
70- "attempted to instantiate uninhabited type `[!; 2] `"
69+ || mem:: zeroed :: < ! > ( ) ,
70+ "attempted to instantiate uninhabited type `! `"
7171 ) ;
7272 test_panic_msg (
73- || mem :: zeroed :: < !> ( ) ,
73+ || MaybeUninit :: < !> :: uninit ( ) . assume_init ( ) ,
7474 "attempted to instantiate uninhabited type `!`"
7575 ) ;
7676 test_panic_msg (
77- || mem:: zeroed :: < [ !; 2 ] > ( ) ,
77+ || mem:: uninitialized :: < [ !; 2 ] > ( ) ,
7878 "attempted to instantiate uninhabited type `[!; 2]`"
7979 ) ;
8080 test_panic_msg (
81- || MaybeUninit :: < ! > :: uninit ( ) . assume_init ( ) ,
82- "attempted to instantiate uninhabited type `! `"
81+ || mem :: zeroed :: < [ ! ; 2 ] > ( ) ,
82+ "attempted to instantiate uninhabited type `[!; 2] `"
8383 ) ;
8484 test_panic_msg (
8585 || MaybeUninit :: < [ !; 2 ] > :: uninit ( ) . assume_init ( ) ,
@@ -91,20 +91,20 @@ fn main() {
9191 "attempted to instantiate uninhabited type `Foo`"
9292 ) ;
9393 test_panic_msg (
94- || mem:: uninitialized :: < [ Foo ; 2 ] > ( ) ,
95- "attempted to instantiate uninhabited type `[ Foo; 2] `"
94+ || mem:: zeroed :: < Foo > ( ) ,
95+ "attempted to instantiate uninhabited type `Foo`"
9696 ) ;
9797 test_panic_msg (
98- || mem :: zeroed :: < Foo > ( ) ,
98+ || MaybeUninit :: < Foo > :: uninit ( ) . assume_init ( ) ,
9999 "attempted to instantiate uninhabited type `Foo`"
100100 ) ;
101101 test_panic_msg (
102- || mem:: zeroed :: < [ Foo ; 2 ] > ( ) ,
102+ || mem:: uninitialized :: < [ Foo ; 2 ] > ( ) ,
103103 "attempted to instantiate uninhabited type `[Foo; 2]`"
104104 ) ;
105105 test_panic_msg (
106- || MaybeUninit :: < Foo > :: uninit ( ) . assume_init ( ) ,
107- "attempted to instantiate uninhabited type `Foo`"
106+ || mem :: zeroed :: < [ Foo ; 2 ] > ( ) ,
107+ "attempted to instantiate uninhabited type `[ Foo; 2] `"
108108 ) ;
109109 test_panic_msg (
110110 || MaybeUninit :: < [ Foo ; 2 ] > :: uninit ( ) . assume_init ( ) ,
@@ -116,20 +116,20 @@ fn main() {
116116 "attempted to instantiate uninhabited type `Bar`"
117117 ) ;
118118 test_panic_msg (
119- || mem:: uninitialized :: < [ Bar ; 4 ] > ( ) ,
120- "attempted to instantiate uninhabited type `[ Bar; 4] `"
119+ || mem:: zeroed :: < Bar > ( ) ,
120+ "attempted to instantiate uninhabited type `Bar`"
121121 ) ;
122122 test_panic_msg (
123- || mem :: zeroed :: < Bar > ( ) ,
123+ || MaybeUninit :: < Bar > :: uninit ( ) . assume_init ( ) ,
124124 "attempted to instantiate uninhabited type `Bar`"
125125 ) ;
126126 test_panic_msg (
127- || mem:: zeroed :: < [ Bar ; 4 ] > ( ) ,
127+ || mem:: uninitialized :: < [ Bar ; 4 ] > ( ) ,
128128 "attempted to instantiate uninhabited type `[Bar; 4]`"
129129 ) ;
130130 test_panic_msg (
131- || MaybeUninit :: < Bar > :: uninit ( ) . assume_init ( ) ,
132- "attempted to instantiate uninhabited type `Bar`"
131+ || mem :: zeroed :: < [ Bar ; 4 ] > ( ) ,
132+ "attempted to instantiate uninhabited type `[ Bar; 4] `"
133133 ) ;
134134 test_panic_msg (
135135 || MaybeUninit :: < [ Bar ; 4 ] > :: uninit ( ) . assume_init ( ) ,
@@ -141,14 +141,14 @@ fn main() {
141141 || mem:: uninitialized :: < fn ( ) > ( ) ,
142142 "attempted to leave type `fn()` uninitialized, which is invalid"
143143 ) ;
144- test_panic_msg (
145- || mem:: uninitialized :: < [ fn ( ) ; 2 ] > ( ) ,
146- "attempted to leave type `[fn(); 2]` uninitialized, which is invalid"
147- ) ;
148144 test_panic_msg (
149145 || mem:: zeroed :: < fn ( ) > ( ) ,
150146 "attempted to zero-initialize type `fn()`, which is invalid"
151147 ) ;
148+ test_panic_msg (
149+ || mem:: uninitialized :: < [ fn ( ) ; 2 ] > ( ) ,
150+ "attempted to leave type `[fn(); 2]` uninitialized, which is invalid"
151+ ) ;
152152 test_panic_msg (
153153 || mem:: zeroed :: < [ fn ( ) ; 2 ] > ( ) ,
154154 "attempted to zero-initialize type `[fn(); 2]`, which is invalid"
@@ -158,17 +158,19 @@ fn main() {
158158 || mem:: uninitialized :: < * const dyn Send > ( ) ,
159159 "attempted to leave type `*const dyn std::marker::Send` uninitialized, which is invalid"
160160 ) ;
161- test_panic_msg (
162- || mem:: uninitialized :: < [ * const dyn Send ; 2 ] > ( ) ,
163- "attempted to leave type `[*const dyn std::marker::Send; 2]` uninitialized, which is invalid"
164- ) ;
165161 test_panic_msg (
166162 || mem:: zeroed :: < * const dyn Send > ( ) ,
167163 "attempted to zero-initialize type `*const dyn std::marker::Send`, which is invalid"
168164 ) ;
165+ test_panic_msg (
166+ || mem:: uninitialized :: < [ * const dyn Send ; 2 ] > ( ) ,
167+ "attempted to leave type `[*const dyn std::marker::Send; 2]` uninitialized, \
168+ which is invalid"
169+ ) ;
169170 test_panic_msg (
170171 || mem:: zeroed :: < [ * const dyn Send ; 2 ] > ( ) ,
171- "attempted to zero-initialize type `[*const dyn std::marker::Send; 2]`, which is invalid"
172+ "attempted to zero-initialize type `[*const dyn std::marker::Send; 2]`, \
173+ which is invalid"
172174 ) ;
173175
174176 /* FIXME(#66151) we conservatively do not error here yet.
@@ -199,13 +201,13 @@ fn main() {
199201 which is invalid"
200202 ) ;
201203 test_panic_msg (
202- || mem:: uninitialized :: < [ ( NonNull < u32 > , u32 , u32 ) ; 2 ] > ( ) ,
203- "attempted to leave type `[ (std::ptr::NonNull<u32>, u32, u32); 2]` uninitialized , \
204+ || mem:: zeroed :: < ( NonNull < u32 > , u32 , u32 ) > ( ) ,
205+ "attempted to zero-initialize type `(std::ptr::NonNull<u32>, u32, u32)` , \
204206 which is invalid"
205207 ) ;
206208 test_panic_msg (
207- || mem:: zeroed :: < ( NonNull < u32 > , u32 , u32 ) > ( ) ,
208- "attempted to zero-initialize type `(std::ptr::NonNull<u32>, u32, u32)` , \
209+ || mem:: uninitialized :: < [ ( NonNull < u32 > , u32 , u32 ) ; 2 ] > ( ) ,
210+ "attempted to leave type `[ (std::ptr::NonNull<u32>, u32, u32); 2]` uninitialized , \
209211 which is invalid"
210212 ) ;
211213 test_panic_msg (
@@ -220,13 +222,13 @@ fn main() {
220222 which is invalid"
221223 ) ;
222224 test_panic_msg (
223- || mem:: uninitialized :: < [ OneVariant_NonZero ; 2 ] > ( ) ,
224- "attempted to leave type `[ OneVariant_NonZero; 2]` uninitialized , \
225+ || mem:: zeroed :: < OneVariant_NonZero > ( ) ,
226+ "attempted to zero-initialize type `OneVariant_NonZero` , \
225227 which is invalid"
226228 ) ;
227229 test_panic_msg (
228- || mem:: zeroed :: < OneVariant_NonZero > ( ) ,
229- "attempted to zero-initialize type `OneVariant_NonZero` , \
230+ || mem:: uninitialized :: < [ OneVariant_NonZero ; 2 ] > ( ) ,
231+ "attempted to leave type `[ OneVariant_NonZero; 2]` uninitialized , \
230232 which is invalid"
231233 ) ;
232234 test_panic_msg (
@@ -241,13 +243,13 @@ fn main() {
241243 which is invalid"
242244 ) ;
243245 test_panic_msg (
244- || mem:: uninitialized :: < [ NoNullVariant ; 2 ] > ( ) ,
245- "attempted to leave type `[ NoNullVariant; 2]` uninitialized , \
246+ || mem:: zeroed :: < NoNullVariant > ( ) ,
247+ "attempted to zero-initialize type `NoNullVariant` , \
246248 which is invalid"
247249 ) ;
248250 test_panic_msg (
249- || mem:: zeroed :: < NoNullVariant > ( ) ,
250- "attempted to zero-initialize type `NoNullVariant` , \
251+ || mem:: uninitialized :: < [ NoNullVariant ; 2 ] > ( ) ,
252+ "attempted to leave type `[ NoNullVariant; 2]` uninitialized , \
251253 which is invalid"
252254 ) ;
253255 test_panic_msg (
@@ -261,10 +263,6 @@ fn main() {
261263 || mem:: uninitialized :: < bool > ( ) ,
262264 "attempted to leave type `bool` uninitialized, which is invalid"
263265 ) ;
264- test_panic_msg (
265- || mem:: uninitialized :: < [ bool ; 2 ] > ( ) ,
266- "attempted to leave type `[bool; 2]` uninitialized, which is invalid"
267- ) ;
268266 test_panic_msg (
269267 || mem:: uninitialized :: < LR > ( ) ,
270268 "attempted to leave type `LR` uninitialized, which is invalid"
@@ -273,6 +271,19 @@ fn main() {
273271 || mem:: uninitialized :: < ManuallyDrop < LR > > ( ) ,
274272 "attempted to leave type `std::mem::ManuallyDrop<LR>` uninitialized, which is invalid"
275273 ) ;
274+ test_panic_msg (
275+ || mem:: uninitialized :: < [ bool ; 2 ] > ( ) ,
276+ "attempted to leave type `[bool; 2]` uninitialized, which is invalid"
277+ ) ;
278+ test_panic_msg (
279+ || mem:: uninitialized :: < [ LR ; 2 ] > ( ) ,
280+ "attempted to leave type `[LR; 2]` uninitialized, which is invalid"
281+ ) ;
282+ test_panic_msg (
283+ || mem:: uninitialized :: < [ ManuallyDrop < LR > ; 2 ] > ( ) ,
284+ "attempted to leave type `[std::mem::ManuallyDrop<LR>; 2]` uninitialized, \
285+ which is invalid"
286+ ) ;
276287
277288 // Some things that should work.
278289 let _val = mem:: zeroed :: < bool > ( ) ;
0 commit comments