@@ -70,11 +70,11 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
7070 // HACK(eddyb) Avoid having RustCall on closures,
7171 // as it adds unnecessary (and wrong) auto-tupling.
7272 abi = Abi :: Rust ;
73- Some ( ( liberated_closure_env_ty ( tcx, id, body_id) , None ) )
73+ Some ( ArgInfo ( liberated_closure_env_ty ( tcx, id, body_id) , None ) )
7474 }
7575 ty:: TyGenerator ( ..) => {
7676 let gen_ty = tcx. body_tables ( body_id) . node_id_to_type ( fn_hir_id) ;
77- Some ( ( gen_ty, None ) )
77+ Some ( ArgInfo ( gen_ty, None ) )
7878 }
7979 _ => None ,
8080 } ;
@@ -91,7 +91,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
9191 . iter ( )
9292 . enumerate ( )
9393 . map ( |( index, arg) | {
94- ( fn_sig. inputs ( ) [ index] , Some ( & * arg. pat ) )
94+ ArgInfo ( fn_sig. inputs ( ) [ index] , Some ( & * arg. pat ) )
9595 } ) ;
9696
9797 let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
@@ -433,6 +433,8 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
433433///////////////////////////////////////////////////////////////////////////
434434/// the main entry point for building MIR for a function
435435
436+ struct ArgInfo < ' gcx > ( Ty < ' gcx > , Option < & ' gcx hir:: Pat > ) ;
437+
436438fn construct_fn < ' a , ' gcx , ' tcx , A > ( hir : Cx < ' a , ' gcx , ' tcx > ,
437439 fn_id : ast:: NodeId ,
438440 arguments : A ,
@@ -442,7 +444,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
442444 yield_ty : Option < Ty < ' gcx > > ,
443445 body : & ' gcx hir:: Body )
444446 -> Mir < ' tcx >
445- where A : Iterator < Item =( Ty < ' gcx > , Option < & ' gcx hir :: Pat > ) >
447+ where A : Iterator < Item =ArgInfo < ' gcx > >
446448{
447449 let arguments: Vec < _ > = arguments. collect ( ) ;
448450
@@ -642,13 +644,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
642644
643645 fn args_and_body ( & mut self ,
644646 mut block : BasicBlock ,
645- arguments : & [ ( Ty < ' gcx > , Option < & ' gcx hir :: Pat > ) ] ,
647+ arguments : & [ ArgInfo < ' gcx > ] ,
646648 argument_scope : region:: Scope ,
647649 ast_body : & ' gcx hir:: Expr )
648650 -> BlockAnd < ( ) >
649651 {
650652 // Allocate locals for the function arguments
651- for & ( ty, pattern) in arguments. iter ( ) {
653+ for & ArgInfo ( ty, pattern) in arguments. iter ( ) {
652654 // If this is a simple binding pattern, give the local a nice name for debuginfo.
653655 let mut name = None ;
654656 if let Some ( pat) = pattern {
@@ -674,7 +676,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
674676
675677 let mut scope = None ;
676678 // Bind the argument patterns
677- for ( index, & ( ty, pattern) ) in arguments. iter ( ) . enumerate ( ) {
679+ for ( index, & ArgInfo ( ty, pattern) ) in arguments. iter ( ) . enumerate ( ) {
678680 // Function arguments always get the first Local indices after the return place
679681 let local = Local :: new ( index + 1 ) ;
680682 let place = Place :: Local ( local) ;
0 commit comments