1
Fork 0

Rollup merge of #130293 - gurry:130142-lint-level-issue, r=cjgillot

Fix lint levels not getting overridden by attrs on `Stmt` nodes

Fixes #130142. See comments on the issue for context.

r? `@cjgillot`
This commit is contained in:
Matthias Krüger 2024-09-15 16:01:37 +02:00 committed by GitHub
commit 18a93ca65e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 70 additions and 9 deletions

View file

@ -255,11 +255,9 @@ impl<'tcx> Visitor<'tcx> for LintLevelsBuilder<'_, LintLevelQueryMap<'tcx>> {
intravisit::walk_foreign_item(self, it);
}
fn visit_stmt(&mut self, e: &'tcx hir::Stmt<'tcx>) {
// We will call `add_id` when we walk
// the `StmtKind`. The outer statement itself doesn't
// define the lint levels.
intravisit::walk_stmt(self, e);
fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) {
self.add_id(s.hir_id);
intravisit::walk_stmt(self, s);
}
fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) {