@@ -70,11 +70,11 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
70
70
// HACK(eddyb) Avoid having RustCall on closures,
71
71
// as it adds unnecessary (and wrong) auto-tupling.
72
72
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 ) )
74
74
}
75
75
ty:: TyGenerator ( ..) => {
76
76
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 ) )
78
78
}
79
79
_ => None ,
80
80
} ;
@@ -91,7 +91,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
91
91
. iter ( )
92
92
. enumerate ( )
93
93
. map ( |( index, arg) | {
94
- ( fn_sig. inputs ( ) [ index] , Some ( & * arg. pat ) )
94
+ ArgInfo ( fn_sig. inputs ( ) [ index] , Some ( & * arg. pat ) )
95
95
} ) ;
96
96
97
97
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>,
433
433
///////////////////////////////////////////////////////////////////////////
434
434
/// the main entry point for building MIR for a function
435
435
436
+ struct ArgInfo < ' gcx > ( Ty < ' gcx > , Option < & ' gcx hir:: Pat > ) ;
437
+
436
438
fn construct_fn < ' a , ' gcx , ' tcx , A > ( hir : Cx < ' a , ' gcx , ' tcx > ,
437
439
fn_id : ast:: NodeId ,
438
440
arguments : A ,
@@ -442,7 +444,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
442
444
yield_ty : Option < Ty < ' gcx > > ,
443
445
body : & ' gcx hir:: Body )
444
446
-> Mir < ' tcx >
445
- where A : Iterator < Item =( Ty < ' gcx > , Option < & ' gcx hir :: Pat > ) >
447
+ where A : Iterator < Item =ArgInfo < ' gcx > >
446
448
{
447
449
let arguments: Vec < _ > = arguments. collect ( ) ;
448
450
@@ -642,13 +644,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
642
644
643
645
fn args_and_body ( & mut self ,
644
646
mut block : BasicBlock ,
645
- arguments : & [ ( Ty < ' gcx > , Option < & ' gcx hir :: Pat > ) ] ,
647
+ arguments : & [ ArgInfo < ' gcx > ] ,
646
648
argument_scope : region:: Scope ,
647
649
ast_body : & ' gcx hir:: Expr )
648
650
-> BlockAnd < ( ) >
649
651
{
650
652
// Allocate locals for the function arguments
651
- for & ( ty, pattern) in arguments. iter ( ) {
653
+ for & ArgInfo ( ty, pattern) in arguments. iter ( ) {
652
654
// If this is a simple binding pattern, give the local a nice name for debuginfo.
653
655
let mut name = None ;
654
656
if let Some ( pat) = pattern {
@@ -674,7 +676,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
674
676
675
677
let mut scope = None ;
676
678
// Bind the argument patterns
677
- for ( index, & ( ty, pattern) ) in arguments. iter ( ) . enumerate ( ) {
679
+ for ( index, & ArgInfo ( ty, pattern) ) in arguments. iter ( ) . enumerate ( ) {
678
680
// Function arguments always get the first Local indices after the return place
679
681
let local = Local :: new ( index + 1 ) ;
680
682
let place = Place :: Local ( local) ;
0 commit comments