@@ -1112,7 +1112,6 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1112
1112
let mut bindings = smallvec ! [ ( false , <_>:: default ( ) ) ] ;
1113
1113
for Param { pat, ty, .. } in params {
1114
1114
self . resolve_pattern ( pat, PatternSource :: FnParam , & mut bindings) ;
1115
- self . check_consistent_bindings_top ( pat) ;
1116
1115
self . visit_ty ( ty) ;
1117
1116
debug ! ( "(resolving function / closure) recorded parameter" ) ;
1118
1117
}
@@ -1248,29 +1247,15 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1248
1247
1249
1248
fn resolve_arm ( & mut self , arm : & Arm ) {
1250
1249
self . with_rib ( ValueNS , NormalRibKind , |this| {
1251
- this. resolve_pats ( & arm. pats , PatternSource :: Match ) ;
1250
+ this. resolve_pattern_top ( & arm. pat , PatternSource :: Match ) ;
1252
1251
walk_list ! ( this, visit_expr, & arm. guard) ;
1253
1252
this. visit_expr ( & arm. body ) ;
1254
1253
} ) ;
1255
1254
}
1256
1255
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.
1270
1257
fn resolve_pattern_top ( & mut self , pat : & Pat , pat_src : PatternSource ) {
1271
1258
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) ;
1274
1259
}
1275
1260
1276
1261
fn resolve_pattern (
@@ -1280,6 +1265,8 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1280
1265
bindings : & mut SmallVec < [ ( bool , FxHashSet < Ident > ) ; 1 ] > ,
1281
1266
) {
1282
1267
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) ;
1283
1270
visit:: walk_pat ( self , pat) ;
1284
1271
}
1285
1272
@@ -1866,9 +1853,9 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1866
1853
visit:: walk_expr ( self , expr) ;
1867
1854
}
1868
1855
1869
- ExprKind :: Let ( ref pats , ref scrutinee) => {
1856
+ ExprKind :: Let ( ref pat , ref scrutinee) => {
1870
1857
self . visit_expr ( scrutinee) ;
1871
- self . resolve_pats ( pats , PatternSource :: Let ) ;
1858
+ self . resolve_pattern_top ( pat , PatternSource :: Let ) ;
1872
1859
}
1873
1860
1874
1861
ExprKind :: If ( ref cond, ref then, ref opt_else) => {
0 commit comments