Skip to content

Commit 0c84473

Browse files
committed
Remove $hir argument from late_lint_methods!.
Because it's always `'tcx`.
1 parent e491d2b commit 0c84473

File tree

2 files changed

+40
-42
lines changed

2 files changed

+40
-42
lines changed

compiler/rustc_lint/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ late_lint_methods!(
179179
// Keeps a global list of foreign declarations.
180180
ClashingExternDeclarations: ClashingExternDeclarations::new(),
181181
]
182-
],
183-
['tcx]
182+
]
184183
);
185184

186185
late_lint_methods!(
@@ -229,8 +228,7 @@ late_lint_methods!(
229228
NamedAsmLabels: NamedAsmLabels,
230229
OpaqueHiddenInferredBound: OpaqueHiddenInferredBound,
231230
]
232-
],
233-
['tcx]
231+
]
234232
);
235233

236234
pub fn new_lint_store(internal_lints: bool) -> LintStore {

compiler/rustc_lint/src/passes.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,49 @@ use rustc_span::Span;
99

1010
#[macro_export]
1111
macro_rules! late_lint_methods {
12-
($macro:path, $args:tt, [$hir:tt]) => (
13-
$macro!($args, [$hir], [
14-
fn check_body(a: &$hir hir::Body<$hir>);
15-
fn check_body_post(a: &$hir hir::Body<$hir>);
12+
($macro:path, $args:tt) => (
13+
$macro!($args, [
14+
fn check_body(a: &'tcx hir::Body<'tcx>);
15+
fn check_body_post(a: &'tcx hir::Body<'tcx>);
1616
fn check_crate();
1717
fn check_crate_post();
18-
fn check_mod(a: &$hir hir::Mod<$hir>, b: hir::HirId);
19-
fn check_foreign_item(a: &$hir hir::ForeignItem<$hir>);
20-
fn check_item(a: &$hir hir::Item<$hir>);
21-
fn check_item_post(a: &$hir hir::Item<$hir>);
22-
fn check_local(a: &$hir hir::Local<$hir>);
23-
fn check_block(a: &$hir hir::Block<$hir>);
24-
fn check_block_post(a: &$hir hir::Block<$hir>);
25-
fn check_stmt(a: &$hir hir::Stmt<$hir>);
26-
fn check_arm(a: &$hir hir::Arm<$hir>);
27-
fn check_pat(a: &$hir hir::Pat<$hir>);
28-
fn check_expr(a: &$hir hir::Expr<$hir>);
29-
fn check_expr_post(a: &$hir hir::Expr<$hir>);
30-
fn check_ty(a: &$hir hir::Ty<$hir>);
31-
fn check_generic_param(a: &$hir hir::GenericParam<$hir>);
32-
fn check_generics(a: &$hir hir::Generics<$hir>);
33-
fn check_poly_trait_ref(a: &$hir hir::PolyTraitRef<$hir>);
18+
fn check_mod(a: &'tcx hir::Mod<'tcx>, b: hir::HirId);
19+
fn check_foreign_item(a: &'tcx hir::ForeignItem<'tcx>);
20+
fn check_item(a: &'tcx hir::Item<'tcx>);
21+
fn check_item_post(a: &'tcx hir::Item<'tcx>);
22+
fn check_local(a: &'tcx hir::Local<'tcx>);
23+
fn check_block(a: &'tcx hir::Block<'tcx>);
24+
fn check_block_post(a: &'tcx hir::Block<'tcx>);
25+
fn check_stmt(a: &'tcx hir::Stmt<'tcx>);
26+
fn check_arm(a: &'tcx hir::Arm<'tcx>);
27+
fn check_pat(a: &'tcx hir::Pat<'tcx>);
28+
fn check_expr(a: &'tcx hir::Expr<'tcx>);
29+
fn check_expr_post(a: &'tcx hir::Expr<'tcx>);
30+
fn check_ty(a: &'tcx hir::Ty<'tcx>);
31+
fn check_generic_param(a: &'tcx hir::GenericParam<'tcx>);
32+
fn check_generics(a: &'tcx hir::Generics<'tcx>);
33+
fn check_poly_trait_ref(a: &'tcx hir::PolyTraitRef<'tcx>);
3434
fn check_fn(
35-
a: rustc_hir::intravisit::FnKind<$hir>,
36-
b: &$hir hir::FnDecl<$hir>,
37-
c: &$hir hir::Body<$hir>,
35+
a: rustc_hir::intravisit::FnKind<'tcx>,
36+
b: &'tcx hir::FnDecl<'tcx>,
37+
c: &'tcx hir::Body<'tcx>,
3838
d: Span,
3939
e: hir::HirId);
40-
fn check_trait_item(a: &$hir hir::TraitItem<$hir>);
41-
fn check_impl_item(a: &$hir hir::ImplItem<$hir>);
42-
fn check_impl_item_post(a: &$hir hir::ImplItem<$hir>);
43-
fn check_struct_def(a: &$hir hir::VariantData<$hir>);
44-
fn check_field_def(a: &$hir hir::FieldDef<$hir>);
45-
fn check_variant(a: &$hir hir::Variant<$hir>);
46-
fn check_path(a: &hir::Path<$hir>, b: hir::HirId);
47-
fn check_attribute(a: &$hir ast::Attribute);
40+
fn check_trait_item(a: &'tcx hir::TraitItem<'tcx>);
41+
fn check_impl_item(a: &'tcx hir::ImplItem<'tcx>);
42+
fn check_impl_item_post(a: &'tcx hir::ImplItem<'tcx>);
43+
fn check_struct_def(a: &'tcx hir::VariantData<'tcx>);
44+
fn check_field_def(a: &'tcx hir::FieldDef<'tcx>);
45+
fn check_variant(a: &'tcx hir::Variant<'tcx>);
46+
fn check_path(a: &hir::Path<'tcx>, b: hir::HirId);
47+
fn check_attribute(a: &'tcx ast::Attribute);
4848

4949
/// Called when entering a syntax node that can have lint attributes such
5050
/// as `#[allow(...)]`. Called with *all* the attributes of that node.
51-
fn enter_lint_attrs(a: &$hir [ast::Attribute]);
51+
fn enter_lint_attrs(a: &'tcx [ast::Attribute]);
5252

5353
/// Counterpart to `enter_lint_attrs`.
54-
fn exit_lint_attrs(a: &$hir [ast::Attribute]);
54+
fn exit_lint_attrs(a: &'tcx [ast::Attribute]);
5555
]);
5656
)
5757
}
@@ -66,14 +66,14 @@ macro_rules! late_lint_methods {
6666
// contains a few lint-specific methods with no equivalent in `Visitor`.
6767

6868
macro_rules! declare_late_lint_pass {
69-
([], [$hir:tt], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
70-
pub trait LateLintPass<$hir>: LintPass {
71-
$(#[inline(always)] fn $name(&mut self, _: &LateContext<$hir>, $(_: $arg),*) {})*
69+
([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
70+
pub trait LateLintPass<'tcx>: LintPass {
71+
$(#[inline(always)] fn $name(&mut self, _: &LateContext<'tcx>, $(_: $arg),*) {})*
7272
}
7373
)
7474
}
7575

76-
late_lint_methods!(declare_late_lint_pass, [], ['tcx]);
76+
late_lint_methods!(declare_late_lint_pass, []);
7777

7878
impl LateLintPass<'_> for HardwiredLints {}
7979

@@ -95,7 +95,7 @@ macro_rules! expand_combined_late_lint_pass_methods {
9595

9696
#[macro_export]
9797
macro_rules! declare_combined_late_lint_pass {
98-
([$v:vis $name:ident, [$($passes:ident: $constructor:expr,)*]], [$hir:tt], $methods:tt) => (
98+
([$v:vis $name:ident, [$($passes:ident: $constructor:expr,)*]], $methods:tt) => (
9999
#[allow(non_snake_case)]
100100
$v struct $name {
101101
$($passes: $passes,)*

0 commit comments

Comments
 (0)