@@ -1112,7 +1112,6 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
11121112 let mut bindings = smallvec ! [ ( false , <_>:: default ( ) ) ] ;
11131113 for Param { pat, ty, .. } in params {
11141114 self . resolve_pattern ( pat, PatternSource :: FnParam , & mut bindings) ;
1115- self . check_consistent_bindings_top ( pat) ;
11161115 self . visit_ty ( ty) ;
11171116 debug ! ( "(resolving function / closure) recorded parameter" ) ;
11181117 }
@@ -1248,29 +1247,15 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
12481247
12491248 fn resolve_arm ( & mut self , arm : & Arm ) {
12501249 self . with_rib ( ValueNS , NormalRibKind , |this| {
1251- this. resolve_pats ( & arm. pats , PatternSource :: Match ) ;
1250+ this. resolve_pattern_top ( & arm. pat , PatternSource :: Match ) ;
12521251 walk_list ! ( this, visit_expr, & arm. guard) ;
12531252 this. visit_expr ( & arm. body ) ;
12541253 } ) ;
12551254 }
12561255
1257- /// Arising from `source`, resolve a sequence of patterns (top level or-patterns).
1258- fn resolve_pats ( & mut self , pats : & [ P < Pat > ] , source : PatternSource ) {
1259- let mut bindings = smallvec ! [ ( true , <_>:: default ( ) ) ] ;
1260- for pat in pats {
1261- bindings. push ( ( false , <_ >:: default ( ) ) ) ;
1262- self . resolve_pattern ( pat, source, & mut bindings) ;
1263- let collected = bindings. pop ( ) . unwrap ( ) . 1 ;
1264- bindings. last_mut ( ) . unwrap ( ) . 1 . extend ( collected) ;
1265- }
1266- // This has to happen *after* we determine which pat_idents are variants
1267- self . check_consistent_bindings ( pats) ;
1268- }
1269-
1256+ /// Arising from `source`, resolve a top level pattern.
12701257 fn resolve_pattern_top ( & mut self , pat : & Pat , pat_src : PatternSource ) {
12711258 self . resolve_pattern ( pat, pat_src, & mut smallvec ! [ ( false , <_>:: default ( ) ) ] ) ;
1272- // This has to happen *after* we determine which pat_idents are variants:
1273- self . check_consistent_bindings_top ( pat) ;
12741259 }
12751260
12761261 fn resolve_pattern (
@@ -1280,6 +1265,8 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
12801265 bindings : & mut SmallVec < [ ( bool , FxHashSet < Ident > ) ; 1 ] > ,
12811266 ) {
12821267 self . resolve_pattern_inner ( pat, pat_src, bindings) ;
1268+ // This has to happen *after* we determine which pat_idents are variants:
1269+ self . check_consistent_bindings_top ( pat) ;
12831270 visit:: walk_pat ( self , pat) ;
12841271 }
12851272
@@ -1866,9 +1853,9 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
18661853 visit:: walk_expr ( self , expr) ;
18671854 }
18681855
1869- ExprKind :: Let ( ref pats , ref scrutinee) => {
1856+ ExprKind :: Let ( ref pat , ref scrutinee) => {
18701857 self . visit_expr ( scrutinee) ;
1871- self . resolve_pats ( pats , PatternSource :: Let ) ;
1858+ self . resolve_pattern_top ( pat , PatternSource :: Let ) ;
18721859 }
18731860
18741861 ExprKind :: If ( ref cond, ref then, ref opt_else) => {
0 commit comments