@@ -426,21 +426,16 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
426426 Ok ( ( ) )
427427 }
428428
429- pub fn assign_discr_and_fields <
430- V : IntoValTyPair < ' tcx > ,
431- J : IntoIterator < Item = V > ,
432- > (
429+ pub fn assign_discr_and_fields (
433430 & mut self ,
434431 dest : Lvalue < ' tcx > ,
435432 dest_ty : Ty < ' tcx > ,
436433 discr_offset : u64 ,
437- operands : J ,
434+ operands : & [ mir :: Operand < ' tcx > ] ,
438435 discr_val : u128 ,
439436 variant_idx : usize ,
440437 discr_size : u64 ,
441- ) -> EvalResult < ' tcx >
442- where J :: IntoIter : ExactSizeIterator ,
443- {
438+ ) -> EvalResult < ' tcx > {
444439 // FIXME(solson)
445440 let dest_ptr = self . force_allocation ( dest) ?. to_ptr ( ) ?;
446441
@@ -456,29 +451,25 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
456451 self . assign_fields ( dest, dest_ty, operands)
457452 }
458453
459- pub fn assign_fields <
460- V : IntoValTyPair < ' tcx > ,
461- J : IntoIterator < Item = V > ,
462- > (
454+ pub fn assign_fields (
463455 & mut self ,
464456 dest : Lvalue < ' tcx > ,
465457 dest_ty : Ty < ' tcx > ,
466- operands : J ,
467- ) -> EvalResult < ' tcx >
468- where J :: IntoIter : ExactSizeIterator ,
469- {
458+ operands : & [ mir:: Operand < ' tcx > ] ,
459+ ) -> EvalResult < ' tcx > {
470460 if self . type_size ( dest_ty) ? == Some ( 0 ) {
471461 // zst assigning is a nop
472462 return Ok ( ( ) ) ;
473463 }
474464 if self . ty_to_primval_kind ( dest_ty) . is_ok ( ) {
475- let mut iter = operands. into_iter ( ) ;
476- assert_eq ! ( iter . len ( ) , 1 ) ;
477- let ( value , value_ty) = iter . next ( ) . unwrap ( ) . into_val_ty_pair ( self ) ? ;
465+ assert_eq ! ( operands. len ( ) , 1 ) ;
466+ let value = self . eval_operand ( & operands [ 0 ] ) ? ;
467+ let value_ty = self . operand_ty ( & operands [ 0 ] ) ;
478468 return self . write_value ( value, dest, value_ty) ;
479469 }
480- for ( field_index, operand) in operands. into_iter ( ) . enumerate ( ) {
481- let ( value, value_ty) = operand. into_val_ty_pair ( self ) ?;
470+ for ( field_index, operand) in operands. iter ( ) . enumerate ( ) {
471+ let value = self . eval_operand ( operand) ?;
472+ let value_ty = self . operand_ty ( operand) ;
482473 let field_dest = self . lvalue_field ( dest, field_index, dest_ty, value_ty) ?;
483474 self . write_value ( value, field_dest, value_ty) ?;
484475 }
@@ -1802,25 +1793,6 @@ pub fn is_inhabited<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) ->
18021793 ty. uninhabited_from ( & mut HashMap :: default ( ) , tcx) . is_empty ( )
18031794}
18041795
1805- pub trait IntoValTyPair < ' tcx > {
1806- fn into_val_ty_pair < ' a > ( self , ecx : & mut EvalContext < ' a , ' tcx > ) -> EvalResult < ' tcx , ( Value , Ty < ' tcx > ) > where ' tcx : ' a ;
1807- }
1808-
1809- impl < ' tcx > IntoValTyPair < ' tcx > for ( Value , Ty < ' tcx > ) {
1810- fn into_val_ty_pair < ' a > ( self , _: & mut EvalContext < ' a , ' tcx > ) -> EvalResult < ' tcx , ( Value , Ty < ' tcx > ) > where ' tcx : ' a {
1811- Ok ( self )
1812- }
1813- }
1814-
1815- impl < ' b , ' tcx : ' b > IntoValTyPair < ' tcx > for & ' b mir:: Operand < ' tcx > {
1816- fn into_val_ty_pair < ' a > ( self , ecx : & mut EvalContext < ' a , ' tcx > ) -> EvalResult < ' tcx , ( Value , Ty < ' tcx > ) > where ' tcx : ' a {
1817- let value = ecx. eval_operand ( self ) ?;
1818- let value_ty = ecx. operand_ty ( self ) ;
1819- Ok ( ( value, value_ty) )
1820- }
1821- }
1822-
1823-
18241796/// FIXME: expose trans::monomorphize::resolve_closure
18251797pub fn resolve_closure < ' a , ' tcx > (
18261798 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
0 commit comments