@@ -381,8 +381,19 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
381
381
. collect :: < Option < Vec < _ > > > ( ) ?;
382
382
let ty = match kind {
383
383
AggregateTy :: Array => {
384
- assert ! ( fields. len( ) > 0 ) ;
385
- Ty :: new_array ( self . tcx , fields[ 0 ] . layout . ty , fields. len ( ) as u64 )
384
+ let [ field, ..] = fields. as_slice ( ) else {
385
+ bug ! ( "fields.len() == 0" ) ;
386
+ } ;
387
+ let field_ty = field. layout . ty ;
388
+ // Ignore nested array
389
+ if field_ty. is_array ( ) {
390
+ trace ! (
391
+ "ignoring nested array of type: [{field_ty}; {len}]" ,
392
+ len = fields. len( ) ,
393
+ ) ;
394
+ return None ;
395
+ }
396
+ Ty :: new_array ( self . tcx , field_ty, fields. len ( ) as u64 )
386
397
}
387
398
AggregateTy :: Tuple => {
388
399
Ty :: new_tup_from_iter ( self . tcx , fields. iter ( ) . map ( |f| f. layout . ty ) )
@@ -412,10 +423,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
412
423
. ecx
413
424
. intern_with_temp_alloc ( ty, |ecx, dest| {
414
425
for ( field_index, op) in fields. iter ( ) . copied ( ) . enumerate ( ) {
415
- // ignore nested arrays
416
- if let Either :: Left ( _) = op. as_mplace_or_imm ( ) {
417
- interpret:: throw_inval!( TooGeneric ) ;
418
- }
419
426
let field_dest = ecx. project_field ( dest, field_index) ?;
420
427
ecx. copy_op ( op, & field_dest) ?;
421
428
}
0 commit comments