@@ -84,23 +84,11 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Body<'
8484 // HACK(eddyb) Avoid having RustCall on closures,
8585 // as it adds unnecessary (and wrong) auto-tupling.
8686 abi = Abi :: Rust ;
87- Some ( ArgInfo {
88- ty : liberated_closure_env_ty ( tcx, id, body_id) ,
89- span : None ,
90- pattern : None ,
91- user_pattern : None ,
92- self_kind : None ,
93- } )
87+ Some ( ArgInfo ( liberated_closure_env_ty ( tcx, id, body_id) , None , None , None ) )
9488 }
9589 ty:: Generator ( ..) => {
9690 let gen_ty = tcx. body_tables ( body_id) . node_type ( id) ;
97- Some ( ArgInfo {
98- ty : gen_ty,
99- span : None ,
100- pattern : None ,
101- user_pattern : None ,
102- self_kind : None ,
103- } )
91+ Some ( ArgInfo ( gen_ty, None , None , None ) )
10492 }
10593 _ => None ,
10694 } ;
@@ -139,14 +127,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Body<'
139127 self_arg = None ;
140128 }
141129
142- let original_pat = tcx. hir ( ) . original_pat_of_argument ( arg) ;
143- ArgInfo {
144- ty : fn_sig. inputs ( ) [ index] ,
145- span : opt_ty_info,
146- pattern : Some ( & * arg. pat ) ,
147- user_pattern : Some ( & original_pat) ,
148- self_kind : self_arg,
149- }
130+ ArgInfo ( fn_sig. inputs ( ) [ index] , opt_ty_info, Some ( & * arg. pat ) , self_arg)
150131 } ) ;
151132
152133 let arguments = implicit_argument. into_iter ( ) . chain ( explicit_arguments) ;
@@ -634,13 +615,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
634615///////////////////////////////////////////////////////////////////////////
635616/// the main entry point for building MIR for a function
636617
637- struct ArgInfo < ' gcx > {
638- ty : Ty < ' gcx > ,
639- span : Option < Span > ,
640- pattern : Option < & ' gcx hir:: Pat > ,
641- user_pattern : Option < & ' gcx hir:: Pat > ,
642- self_kind : Option < ImplicitSelfKind > ,
643- }
618+ struct ArgInfo < ' gcx > ( Ty < ' gcx > , Option < Span > , Option < & ' gcx hir:: Pat > , Option < ImplicitSelfKind > ) ;
644619
645620fn construct_fn < ' a , ' gcx , ' tcx , A > ( hir : Cx < ' a , ' gcx , ' tcx > ,
646621 fn_id : hir:: HirId ,
@@ -901,18 +876,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
901876 -> BlockAnd < ( ) >
902877 {
903878 // Allocate locals for the function arguments
904- for & ArgInfo { ty, span : _, pattern, user_pattern , self_kind : _ } in arguments. iter ( ) {
879+ for & ArgInfo ( ty, _, pattern, _ ) in arguments. iter ( ) {
905880 // If this is a simple binding pattern, give the local a name for
906881 // debuginfo and so that error reporting knows that this is a user
907882 // variable. For any other pattern the pattern introduces new
908883 // variables which will be named instead.
909- let ( name, span) = if let Some ( pat) = user_pattern {
910- match pat. node {
911- hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Unannotated , _, ident, _)
912- | hir:: PatKind :: Binding ( hir:: BindingAnnotation :: Mutable , _, ident, _) =>
913- ( Some ( ident. name ) , pat. span ) ,
914- _ => ( None , pattern. map_or ( self . fn_span , |pat| pat. span ) )
915- }
884+ let ( name, span) = if let Some ( pat) = pattern {
885+ ( pat. simple_ident ( ) . map ( |ident| ident. name ) , pat. span )
916886 } else {
917887 ( None , self . fn_span )
918888 } ;
@@ -937,13 +907,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
937907 // Function arguments always get the first Local indices after the return place
938908 let local = Local :: new ( index + 1 ) ;
939909 let place = Place :: Base ( PlaceBase :: Local ( local) ) ;
940- let & ArgInfo {
941- ty,
942- span : opt_ty_info,
943- pattern,
944- user_pattern : _,
945- self_kind : ref self_binding
946- } = arg_info;
910+ let & ArgInfo ( ty, opt_ty_info, pattern, ref self_binding) = arg_info;
947911
948912 // Make sure we drop (parts of) the argument even when not matched on.
949913 self . schedule_drop (
@@ -958,7 +922,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
958922
959923 match * pattern. kind {
960924 // Don't introduce extra copies for simple bindings
961- PatternKind :: Binding { mutability, var, mode : BindingMode :: ByValue , .. } => {
925+ PatternKind :: Binding {
926+ mutability,
927+ var,
928+ mode : BindingMode :: ByValue ,
929+ subpattern : None ,
930+ ..
931+ } => {
962932 self . local_decls [ local] . mutability = mutability;
963933 self . local_decls [ local] . is_user_variable =
964934 if let Some ( kind) = self_binding {
0 commit comments