@@ -390,8 +390,19 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
390
390
. collect :: < Option < Vec < & OpTy < ' _ > > > > ( ) ?;
391
391
let ty = match kind {
392
392
AggregateTy :: Array => {
393
- assert ! ( fields. len( ) > 0 ) ;
394
- Ty :: new_array ( self . tcx , fields[ 0 ] . layout . ty , fields. len ( ) as u64 )
393
+ let [ field, ..] = fields. as_slice ( ) else {
394
+ bug ! ( "fields.len() == 0" ) ;
395
+ } ;
396
+ let field_ty = field. layout . ty ;
397
+ // Ignore nested array
398
+ if field_ty. is_array ( ) {
399
+ trace ! (
400
+ "ignoring nested array of type: [{field_ty}; {len}]" ,
401
+ len = fields. len( ) ,
402
+ ) ;
403
+ return None ;
404
+ }
405
+ Ty :: new_array ( self . tcx , field_ty, fields. len ( ) as u64 )
395
406
}
396
407
AggregateTy :: Tuple => {
397
408
Ty :: new_tup_from_iter ( self . tcx , fields. iter ( ) . map ( |f| f. layout . ty ) )
@@ -424,10 +435,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
424
435
. ecx
425
436
. intern_with_temp_alloc ( ty, |ecx, dest| {
426
437
for ( field_index, op) in fields. iter ( ) . copied ( ) . enumerate ( ) {
427
- // ignore nested arrays
428
- if let Either :: Left ( _) = op. as_mplace_or_imm ( ) {
429
- interpret:: throw_inval!( TooGeneric ) ;
430
- }
431
438
let field_dest = ecx. project_field ( dest, field_index) ?;
432
439
ecx. copy_op ( op, & field_dest) ?;
433
440
}
0 commit comments