@@ -18,7 +18,6 @@ use rustc_span::{Span, DUMMY_SP};
1818use rustc_target:: abi:: { self , FieldIdx , FIRST_VARIANT } ;
1919
2020use arrayvec:: ArrayVec ;
21- use either:: Either ;
2221
2322impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
2423 #[ instrument( level = "trace" , skip( self , bx) ) ]
@@ -724,24 +723,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
724723 }
725724 mir:: Rvalue :: Use ( ref operand) => self . codegen_operand ( bx, operand) ,
726725 mir:: Rvalue :: Repeat ( ..) => bug ! ( "{rvalue:?} in codegen_rvalue_operand" ) ,
727- mir:: Rvalue :: Aggregate ( ref kind , ref fields) => {
726+ mir:: Rvalue :: Aggregate ( _ , ref fields) => {
728727 let ty = rvalue. ty ( self . mir , self . cx . tcx ( ) ) ;
729728 let ty = self . monomorphize ( ty) ;
730729 let layout = self . cx . layout_of ( ty) ;
731730
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-
740731 // `rvalue_creates_operand` has arranged that we only get here if
741732 // we can build the aggregate immediate from the field immediates.
742733 let mut inputs = ArrayVec :: < Bx :: Value , 2 > :: new ( ) ;
743734 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 ( ) {
745736 let field_idx = FieldIdx :: from_usize ( field_idx) ;
746737 let op = self . codegen_operand ( bx, & fields[ field_idx] ) ;
747738 let values = op. val . immediates_or_place ( ) . left_or_else ( |p| {
0 commit comments