Skip to content

Commit 6ad11e2

Browse files
committed
Auto merge of #81699 - jethrogb:fix-81531, r=petrochenkov
Really fix early lints inside an async desugaring Fixes #81531 cc `@Aaron1011` r? `@petrochenkov`
2 parents d6a28a9 + 37cb9d3 commit 6ad11e2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

compiler/rustc_lint/src/early.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
219219

220220
// Explicitly check for lints associated with 'closure_id', since
221221
// it does not have a corresponding AST node
222-
if let ast::ExprKind::Closure(_, asyncness, ..) = e.kind {
223-
if let ast::Async::Yes { closure_id, .. } = asyncness {
224-
self.check_id(closure_id);
225-
}
222+
match e.kind {
223+
ast::ExprKind::Closure(_, ast::Async::Yes { closure_id, .. }, ..)
224+
| ast::ExprKind::Async(_, closure_id, ..) => self.check_id(closure_id),
225+
_ => {}
226226
}
227227
}
228228

src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.rs

+5
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,9 @@ fn main() {
3333
fn inner() {
3434
let _ = foo!(third);
3535
}
36+
37+
#[allow(semicolon_in_expressions_from_macros)]
38+
async {
39+
let _ = foo!(fourth);
40+
};
3641
}

0 commit comments

Comments
 (0)