@@ -659,15 +659,15 @@ fn expand_non_macro_stmt(s: &Stmt, fld: &mut MacroExpander)
659
659
}
660
660
661
661
fn expand_arm ( arm : & ast:: Arm , fld : & mut MacroExpander ) -> ast:: Arm {
662
- if a . pats . len ( ) == 0 {
662
+ if arm . pats . len ( ) == 0 {
663
663
fail ! ( "encountered match arm with 0 patterns" ) ;
664
664
}
665
- let first_pat = match a . pats . get ( 0 ) {
666
-
667
- }
665
+ // all of the pats must have the same set of bindings, so use the
666
+ // first one to extract them and generate new names:
667
+ let first_pat = arm . pats . get ( 0 ) ;
668
668
// code duplicated from 'let', above. Perhaps this can be lifted
669
669
// into a separate function:
670
- let expanded_pat = fld. fold_pat ( pat ) ;
670
+ let expanded_pat = fld. fold_pat ( * first_pat ) ;
671
671
let mut name_finder = new_name_finder ( Vec :: new ( ) ) ;
672
672
name_finder. visit_pat ( & * expanded_pat, ( ) ) ;
673
673
let mut new_pending_renames = Vec :: new ( ) ;
@@ -681,13 +681,13 @@ fn expand_arm(arm: &ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
681
681
// ones have already been applied):
682
682
rename_fld. fold_pat ( expanded_pat)
683
683
} ;
684
-
685
- let bound_names
686
- ast:: Arm {
687
- attrs : a . attrs . iter ( ) . map ( |x| self . fold_attribute ( * x) ) . collect ( ) ,
688
- pats : a . pats . iter ( ) . map ( |x| self . fold_pat ( * x) ) . collect ( ) ,
689
- guard : a . guard . map ( |x| self . fold_expr ( x) ) ,
690
- body : self . fold_expr ( a . body ) ,
684
+ /*
685
+ */
686
+ ast:: Arm {
687
+ attrs : arm . attrs . iter ( ) . map ( |x| fld . fold_attribute ( * x) ) . collect ( ) ,
688
+ pats : arm . pats . iter ( ) . map ( |x| fld . fold_pat ( * x) ) . collect ( ) ,
689
+ guard : arm . guard . map ( |x| fld . fold_expr ( x) ) ,
690
+ body : fld . fold_expr ( arm . body ) ,
691
691
}
692
692
}
693
693
0 commit comments