Skip to content

Commit

Permalink
Auto merge of rust-lang#81699 - jethrogb:fix-81531, r=petrochenkov
Browse files Browse the repository at this point in the history
Really fix early lints inside an async desugaring

Fixes rust-lang#81531

cc `@Aaron1011`

r? `@petrochenkov`
  • Loading branch information
bors committed Feb 3, 2021
2 parents d6a28a9 + 37cb9d3 commit 6ad11e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_lint/src/early.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>

// Explicitly check for lints associated with 'closure_id', since
// it does not have a corresponding AST node
if let ast::ExprKind::Closure(_, asyncness, ..) = e.kind {
if let ast::Async::Yes { closure_id, .. } = asyncness {
self.check_id(closure_id);
}
match e.kind {
ast::ExprKind::Closure(_, ast::Async::Yes { closure_id, .. }, ..)
| ast::ExprKind::Async(_, closure_id, ..) => self.check_id(closure_id),
_ => {}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ fn main() {
fn inner() {
let _ = foo!(third);
}

#[allow(semicolon_in_expressions_from_macros)]
async {
let _ = foo!(fourth);
};
}

0 comments on commit 6ad11e2

Please sign in to comment.