add guard patterns to HIR and implement lowering
This commit is contained in:
parent
d117b7f211
commit
b579c36224
11 changed files with 40 additions and 7 deletions
|
@ -654,6 +654,7 @@ fn resolve_local<'tcx>(
|
|||
/// | ( ..., P&, ... )
|
||||
/// | ... "|" P& "|" ...
|
||||
/// | box P&
|
||||
/// | P& if ...
|
||||
/// ```
|
||||
fn is_binding_pat(pat: &hir::Pat<'_>) -> bool {
|
||||
// Note that the code below looks for *explicit* refs only, that is, it won't
|
||||
|
@ -694,7 +695,9 @@ fn resolve_local<'tcx>(
|
|||
| PatKind::TupleStruct(_, subpats, _)
|
||||
| PatKind::Tuple(subpats, _) => subpats.iter().any(|p| is_binding_pat(p)),
|
||||
|
||||
PatKind::Box(subpat) | PatKind::Deref(subpat) => is_binding_pat(subpat),
|
||||
PatKind::Box(subpat) | PatKind::Deref(subpat) | PatKind::Guard(subpat, _) => {
|
||||
is_binding_pat(subpat)
|
||||
}
|
||||
|
||||
PatKind::Ref(_, _)
|
||||
| PatKind::Binding(hir::BindingMode(hir::ByRef::No, _), ..)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue