diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-15 16:01:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-15 16:01:37 +0200 |
| commit | 18a93ca65ef4fc97e0455c52c460826b50594ea1 (patch) | |
| tree | dab207082485799a7f2eb119fe8f33773dde166f /compiler | |
| parent | 8ad52ddf9e6fdcf253e60a0120e31263b90ec852 (diff) | |
| parent | fd3ee92c6dd922c91008adf73a372e7851e1dd17 (diff) | |
| download | rust-18a93ca65ef4fc97e0455c52c460826b50594ea1.tar.gz rust-18a93ca65ef4fc97e0455c52c460826b50594ea1.zip | |
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`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/levels.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 65289de980e..796d66f13d4 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -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>) { |
