Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/diagnostics/expr.rs')
-rw-r--r--crates/hir-ty/src/diagnostics/expr.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/hir-ty/src/diagnostics/expr.rs b/crates/hir-ty/src/diagnostics/expr.rs
index e52fae06d7..06c9b2e0e5 100644
--- a/crates/hir-ty/src/diagnostics/expr.rs
+++ b/crates/hir-ty/src/diagnostics/expr.rs
@@ -117,7 +117,7 @@ impl ExprValidator {
Expr::If { .. } => {
self.check_for_unnecessary_else(id, expr, db);
}
- Expr::Block { .. } => {
+ Expr::Block { .. } | Expr::Async { .. } | Expr::Unsafe { .. } => {
self.validate_block(db, expr);
}
_ => {}
@@ -254,7 +254,12 @@ impl ExprValidator {
}
fn validate_block(&mut self, db: &dyn HirDatabase, expr: &Expr) {
- let Expr::Block { statements, .. } = expr else { return };
+ let (Expr::Block { statements, .. }
+ | Expr::Async { statements, .. }
+ | Expr::Unsafe { statements, .. }) = expr
+ else {
+ return;
+ };
let pattern_arena = Arena::new();
let cx = MatchCheckCtx::new(self.owner.module(db.upcast()), self.owner, db);
for stmt in &**statements {