@@ -18,7 +18,6 @@ use rustc_span::{Span, DUMMY_SP};
18
18
use rustc_target:: abi:: { self , FieldIdx , FIRST_VARIANT } ;
19
19
20
20
use arrayvec:: ArrayVec ;
21
- use either:: Either ;
22
21
23
22
impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
24
23
#[ instrument( level = "trace" , skip( self , bx) ) ]
@@ -724,24 +723,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
724
723
}
725
724
mir:: Rvalue :: Use ( ref operand) => self . codegen_operand ( bx, operand) ,
726
725
mir:: Rvalue :: Repeat ( ..) => bug ! ( "{rvalue:?} in codegen_rvalue_operand" ) ,
727
- mir:: Rvalue :: Aggregate ( ref kind , ref fields) => {
726
+ mir:: Rvalue :: Aggregate ( _ , ref fields) => {
728
727
let ty = rvalue. ty ( self . mir , self . cx . tcx ( ) ) ;
729
728
let ty = self . monomorphize ( ty) ;
730
729
let layout = self . cx . layout_of ( ty) ;
731
730
732
- let field_indices = if let mir:: AggregateKind :: RawPtr ( ..) = * * kind {
733
- // `index_by_increasing_offset` gives an empty iterator for primitives
734
- Either :: Left ( [ 0_usize , 1_usize ] . iter ( ) . copied ( ) )
735
- } else {
736
- Either :: Right ( layout. fields . index_by_increasing_offset ( ) )
737
- } ;
738
- debug_assert_eq ! ( field_indices. len( ) , fields. len( ) ) ;
739
-
740
731
// `rvalue_creates_operand` has arranged that we only get here if
741
732
// we can build the aggregate immediate from the field immediates.
742
733
let mut inputs = ArrayVec :: < Bx :: Value , 2 > :: new ( ) ;
743
734
let mut input_scalars = ArrayVec :: < abi:: Scalar , 2 > :: new ( ) ;
744
- for field_idx in field_indices {
735
+ for field_idx in layout . fields . index_by_increasing_offset ( ) {
745
736
let field_idx = FieldIdx :: from_usize ( field_idx) ;
746
737
let op = self . codegen_operand ( bx, & fields[ field_idx] ) ;
747
738
let values = op. val . immediates_or_place ( ) . left_or_else ( |p| {
0 commit comments