From 01d7bf09f380236f6eb059d33971d7bf0d755531 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 13 Sep 2023 19:44:47 +0000 Subject: Visit ExprField for lint levels. --- compiler/rustc_lint/src/late.rs | 4 ++++ compiler/rustc_lint/src/levels.rs | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'compiler/rustc_lint/src') diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 73af51d9e90..43f668ca122 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -157,6 +157,10 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas hir_visit::walk_pat(self, p); } + fn visit_expr_field(&mut self, field: &'tcx hir::ExprField<'tcx>) { + self.with_lint_attrs(field.hir_id, |cx| hir_visit::walk_expr_field(cx, field)) + } + fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) { ensure_sufficient_stack(|| { self.with_lint_attrs(e.hir_id, |cx| { diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index f58782c0f22..ed5627931be 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -333,6 +333,11 @@ impl<'tcx> Visitor<'tcx> for LintLevelsBuilder<'_, LintLevelQueryMap<'tcx>> { intravisit::walk_expr(self, e); } + fn visit_expr_field(&mut self, f: &'tcx hir::ExprField<'tcx>) { + self.add_id(f.hir_id); + intravisit::walk_expr_field(self, f); + } + fn visit_field_def(&mut self, s: &'tcx hir::FieldDef<'tcx>) { self.add_id(s.hir_id); intravisit::walk_field_def(self, s); -- cgit 1.4.1-3-g733a5