Skip to content

Commit f465f95

Browse files
authored
Rollup merge of #67428 - Centril:ibp-explicit-match, r=matthewjasper
`is_binding_pat`: use explicit match & include or-pats in grammar r? @matthewjasper @nikomatsakis
2 parents eaee9d1 + 4414f0d commit f465f95

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustc/middle/region.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ fn resolve_local<'tcx>(
11731173
/// | VariantName(..., P&, ...)
11741174
/// | [ ..., P&, ... ]
11751175
/// | ( ..., P&, ... )
1176+
/// | ... "|" P& "|" ...
11761177
/// | box P&
11771178
fn is_binding_pat(pat: &hir::Pat) -> bool {
11781179
// Note that the code below looks for *explicit* refs only, that is, it won't
@@ -1212,6 +1213,7 @@ fn resolve_local<'tcx>(
12121213
pats3.iter().any(|p| is_binding_pat(&p))
12131214
}
12141215

1216+
PatKind::Or(ref subpats) |
12151217
PatKind::TupleStruct(_, ref subpats, _) |
12161218
PatKind::Tuple(ref subpats, _) => {
12171219
subpats.iter().any(|p| is_binding_pat(&p))
@@ -1221,7 +1223,13 @@ fn resolve_local<'tcx>(
12211223
is_binding_pat(&subpat)
12221224
}
12231225

1224-
_ => false,
1226+
PatKind::Ref(_, _) |
1227+
PatKind::Binding(hir::BindingAnnotation::Unannotated, ..) |
1228+
PatKind::Binding(hir::BindingAnnotation::Mutable, ..) |
1229+
PatKind::Wild |
1230+
PatKind::Path(_) |
1231+
PatKind::Lit(_) |
1232+
PatKind::Range(_, _, _) => false,
12251233
}
12261234
}
12271235

0 commit comments

Comments
 (0)