@@ -390,8 +390,19 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
390390 . collect :: < Option < Vec < & OpTy < ' _ > > > > ( ) ?;
391391 let ty = match kind {
392392 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 )
395406 }
396407 AggregateTy :: Tuple => {
397408 Ty :: new_tup_from_iter ( self . tcx , fields. iter ( ) . map ( |f| f. layout . ty ) )
@@ -424,10 +435,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
424435 . ecx
425436 . intern_with_temp_alloc ( ty, |ecx, dest| {
426437 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- }
431438 let field_dest = ecx. project_field ( dest, field_index) ?;
432439 ecx. copy_op ( op, & field_dest) ?;
433440 }
0 commit comments