1
Fork 0

Run AST validation on match guards correctly

This commit is contained in:
Matthew Jasper 2023-05-22 14:52:52 +01:00
parent 48ec50ae39
commit 72d41f3bd3
6 changed files with 240 additions and 38 deletions

View file

@ -736,11 +736,10 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
this.visit_expr(&arm.body);
this.visit_pat(&arm.pat);
walk_list!(this, visit_attribute, &arm.attrs);
if let Some(guard) = &arm.guard && let ExprKind::Let(_, guard_expr, _) = &guard.kind {
if let Some(guard) = &arm.guard {
this.with_let_management(None, |this, _| {
this.visit_expr(guard_expr)
this.visit_expr(guard)
});
return;
}
}
}