@@ -9,49 +9,49 @@ use rustc_span::Span;
99
1010#[ macro_export]
1111macro_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,21 +66,23 @@ macro_rules! late_lint_methods {
6666// contains a few lint-specific methods with no equivalent in `Visitor`.
6767
6868macro_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+ // Declare the `LateLintPass` trait, which contains empty default definitions
77+ // for all the `check_*` methods.
78+ late_lint_methods ! ( declare_late_lint_pass, [ ] ) ;
7779
7880impl LateLintPass < ' _ > for HardwiredLints { }
7981
8082#[ macro_export]
8183macro_rules! expand_combined_late_lint_pass_method {
82- ( [ $( $passes : ident) ,* ] , $self: ident, $name: ident, $params: tt) => ( {
83- $( $self. $passes . $name $params; ) *
84+ ( [ $( $pass : ident) ,* ] , $self: ident, $name: ident, $params: tt) => ( {
85+ $( $self. $pass . $name $params; ) *
8486 } )
8587}
8688
@@ -95,28 +97,28 @@ macro_rules! expand_combined_late_lint_pass_methods {
9597
9698#[ macro_export]
9799macro_rules! declare_combined_late_lint_pass {
98- ( [ $v: vis $name: ident, [ $( $passes : ident: $constructor: expr, ) * ] ] , [ $hir : tt ] , $methods: tt) => (
100+ ( [ $v: vis $name: ident, [ $( $pass : ident: $constructor: expr, ) * ] ] , $methods: tt) => (
99101 #[ allow( non_snake_case) ]
100102 $v struct $name {
101- $( $passes : $passes , ) *
103+ $( $pass : $pass , ) *
102104 }
103105
104106 impl $name {
105107 $v fn new( ) -> Self {
106108 Self {
107- $( $passes : $constructor, ) *
109+ $( $pass : $constructor, ) *
108110 }
109111 }
110112
111113 $v fn get_lints( ) -> LintArray {
112114 let mut lints = Vec :: new( ) ;
113- $( lints. extend_from_slice( & $passes :: get_lints( ) ) ; ) *
115+ $( lints. extend_from_slice( & $pass :: get_lints( ) ) ; ) *
114116 lints
115117 }
116118 }
117119
118120 impl <' tcx> LateLintPass <' tcx> for $name {
119- expand_combined_late_lint_pass_methods!( [ $( $passes ) ,* ] , $methods) ;
121+ expand_combined_late_lint_pass_methods!( [ $( $pass ) ,* ] , $methods) ;
120122 }
121123
122124 #[ allow( rustc:: lint_pass_impl_without_macro) ]
@@ -176,12 +178,14 @@ macro_rules! declare_early_lint_pass {
176178 )
177179}
178180
181+ // Declare the `EarlyLintPass` trait, which contains empty default definitions
182+ // for all the `check_*` methods.
179183early_lint_methods ! ( declare_early_lint_pass, [ ] ) ;
180184
181185#[ macro_export]
182186macro_rules! expand_combined_early_lint_pass_method {
183- ( [ $( $passes : ident) ,* ] , $self: ident, $name: ident, $params: tt) => ( {
184- $( $self. $passes . $name $params; ) *
187+ ( [ $( $pass : ident) ,* ] , $self: ident, $name: ident, $params: tt) => ( {
188+ $( $self. $pass . $name $params; ) *
185189 } )
186190}
187191
@@ -196,28 +200,28 @@ macro_rules! expand_combined_early_lint_pass_methods {
196200
197201#[ macro_export]
198202macro_rules! declare_combined_early_lint_pass {
199- ( [ $v: vis $name: ident, [ $( $passes : ident: $constructor: expr, ) * ] ] , $methods: tt) => (
203+ ( [ $v: vis $name: ident, [ $( $pass : ident: $constructor: expr, ) * ] ] , $methods: tt) => (
200204 #[ allow( non_snake_case) ]
201205 $v struct $name {
202- $( $passes : $passes , ) *
206+ $( $pass : $pass , ) *
203207 }
204208
205209 impl $name {
206210 $v fn new( ) -> Self {
207211 Self {
208- $( $passes : $constructor, ) *
212+ $( $pass : $constructor, ) *
209213 }
210214 }
211215
212216 $v fn get_lints( ) -> LintArray {
213217 let mut lints = Vec :: new( ) ;
214- $( lints. extend_from_slice( & $passes :: get_lints( ) ) ; ) *
218+ $( lints. extend_from_slice( & $pass :: get_lints( ) ) ; ) *
215219 lints
216220 }
217221 }
218222
219223 impl EarlyLintPass for $name {
220- expand_combined_early_lint_pass_methods!( [ $( $passes ) ,* ] , $methods) ;
224+ expand_combined_early_lint_pass_methods!( [ $( $pass ) ,* ] , $methods) ;
221225 }
222226
223227 #[ allow( rustc:: lint_pass_impl_without_macro) ]
0 commit comments