Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/body/lower.rs')
| -rw-r--r-- | crates/hir_def/src/body/lower.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 759f2cc865..a34c18d6d0 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -650,8 +650,10 @@ impl ExprCollector<'_> { self.statements_in_scope.push(Statement::Let { pat, type_ref, initializer }); } ast::Stmt::ExprStmt(stmt) => { - if self.check_cfg(&stmt).is_none() { - return; + if let Some(expr) = stmt.expr() { + if self.check_cfg(&expr).is_none() { + return; + } } let has_semi = stmt.semicolon_token().is_some(); // Note that macro could be expended to multiple statements |