]> git.lizzy.rs Git - rust.git/blobdiff - crates/hir_def/src/body/lower.rs
feat: allow attributes on all expressions
[rust.git] / crates / hir_def / src / body / lower.rs
index 759f2cc86572bb113be37cf5d4f875a3fd045adf..a34c18d6d0cbae115291677fd1cf942200a1743a 100644 (file)
@@ -650,8 +650,10 @@ fn collect_stmt(&mut self, s: ast::Stmt) {
                 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