diff options
| author | Alex Macleod <alex@macleod.io> | 2024-03-24 14:57:57 +0000 |
|---|---|---|
| committer | Alex Macleod <alex@macleod.io> | 2024-03-24 14:57:57 +0000 |
| commit | 2cb53473d92251a6ba2538fe034ab1ad62224ed1 (patch) | |
| tree | 5de85edf2fdeca020f11c59df60cdb004eb0c10d /compiler | |
| parent | 4a52e9cc2acf102da113d1b6c712afc5fcf4db13 (diff) | |
| download | rust-2cb53473d92251a6ba2538fe034ab1ad62224ed1.tar.gz rust-2cb53473d92251a6ba2538fe034ab1ad62224ed1.zip | |
Rename `{enter,exit}_lint_attrs` to `check_attributes{,_post}`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/early.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/late.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/passes.rs | 18 |
3 files changed, 8 insertions, 23 deletions
diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index d78ec8c0dd3..9fae32a49c7 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -73,10 +73,10 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> { self.inlined_check_id(id); debug!("early context: enter_attrs({:?})", attrs); - lint_callback!(self, enter_lint_attrs, attrs); + lint_callback!(self, check_attributes, attrs); ensure_sufficient_stack(|| f(self)); debug!("early context: exit_attrs({:?})", attrs); - lint_callback!(self, exit_lint_attrs, attrs); + lint_callback!(self, check_attributes_post, attrs); self.context.builder.pop(push); } } diff --git a/compiler/rustc_lint/src/late.rs b/compiler/rustc_lint/src/late.rs index 384bd353d75..99207e3f315 100644 --- a/compiler/rustc_lint/src/late.rs +++ b/compiler/rustc_lint/src/late.rs @@ -15,7 +15,6 @@ //! for all lint attributes. use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore}; -use rustc_ast as ast; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::sync::{join, Lrc}; use rustc_hir as hir; @@ -62,13 +61,13 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> { let prev = self.context.last_node_with_lint_attrs; self.context.last_node_with_lint_attrs = id; debug!("late context: enter_attrs({:?})", attrs); - lint_callback!(self, enter_lint_attrs, attrs); + lint_callback!(self, check_attributes, attrs); for attr in attrs { lint_callback!(self, check_attribute, attr); } f(self); debug!("late context: exit_attrs({:?})", attrs); - lint_callback!(self, exit_lint_attrs, attrs); + lint_callback!(self, check_attributes_post, attrs); self.context.last_node_with_lint_attrs = prev; } @@ -310,10 +309,6 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas lint_callback!(self, check_path, p, id); hir_visit::walk_path(self, p); } - - fn visit_attribute(&mut self, attr: &'tcx ast::Attribute) { - lint_callback!(self, check_attribute, attr); - } } // Combines multiple lint passes into a single pass, at runtime. Each diff --git a/compiler/rustc_lint/src/passes.rs b/compiler/rustc_lint/src/passes.rs index 3e93cc0be6a..d8ba84eb7a1 100644 --- a/compiler/rustc_lint/src/passes.rs +++ b/compiler/rustc_lint/src/passes.rs @@ -41,13 +41,8 @@ macro_rules! late_lint_methods { fn check_variant(a: &'tcx rustc_hir::Variant<'tcx>); fn check_path(a: &rustc_hir::Path<'tcx>, b: rustc_hir::HirId); fn check_attribute(a: &'tcx rustc_ast::Attribute); - - /// Called when entering a syntax node that can have lint attributes such - /// as `#[allow(...)]`. Called with *all* the attributes of that node. - fn enter_lint_attrs(a: &'tcx [rustc_ast::Attribute]); - - /// Counterpart to `enter_lint_attrs`. - fn exit_lint_attrs(a: &'tcx [rustc_ast::Attribute]); + fn check_attributes(a: &'tcx [rustc_ast::Attribute]); + fn check_attributes_post(a: &'tcx [rustc_ast::Attribute]); ]); ) } @@ -162,16 +157,11 @@ macro_rules! early_lint_methods { fn check_impl_item(a: &rustc_ast::AssocItem); fn check_variant(a: &rustc_ast::Variant); fn check_attribute(a: &rustc_ast::Attribute); + fn check_attributes(a: &[rustc_ast::Attribute]); + fn check_attributes_post(a: &[rustc_ast::Attribute]); fn check_mac_def(a: &rustc_ast::MacroDef); fn check_mac(a: &rustc_ast::MacCall); - /// Called when entering a syntax node that can have lint attributes such - /// as `#[allow(...)]`. Called with *all* the attributes of that node. - fn enter_lint_attrs(a: &[rustc_ast::Attribute]); - - /// Counterpart to `enter_lint_attrs`. - fn exit_lint_attrs(a: &[rustc_ast::Attribute]); - fn enter_where_predicate(a: &rustc_ast::WherePredicate); fn exit_where_predicate(a: &rustc_ast::WherePredicate); ]); |
