@@ -5,6 +5,7 @@ use crate::context::{EarlyContext, LateContext};
55#[ macro_export]
66macro_rules! late_lint_methods {
77 ( $macro: path, $args: tt) => (
8+ // `_post` methods are called *after* recursing into the node.
89 $macro!( $args, [
910 fn check_body( a: & rustc_hir:: Body <' tcx>) ;
1011 fn check_body_post( a: & rustc_hir:: Body <' tcx>) ;
@@ -13,8 +14,6 @@ macro_rules! late_lint_methods {
1314 fn check_mod( a: & ' tcx rustc_hir:: Mod <' tcx>, b: rustc_hir:: HirId ) ;
1415 fn check_foreign_item( a: & ' tcx rustc_hir:: ForeignItem <' tcx>) ;
1516 fn check_item( a: & ' tcx rustc_hir:: Item <' tcx>) ;
16- /// This is called *after* recursing into the item
17- /// (in contrast to `check_item`, which is checked before).
1817 fn check_item_post( a: & ' tcx rustc_hir:: Item <' tcx>) ;
1918 fn check_local( a: & ' tcx rustc_hir:: LetStmt <' tcx>) ;
2019 fn check_block( a: & ' tcx rustc_hir:: Block <' tcx>) ;
@@ -59,7 +58,7 @@ macro_rules! late_lint_methods {
5958// contains a few lint-specific methods with no equivalent in `Visitor`.
6059//
6160macro_rules! declare_late_lint_pass {
62- ( [ ] , [ $( $ ( # [ $attr : meta ] ) * fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
61+ ( [ ] , [ $( fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
6362 pub trait LateLintPass <' tcx>: LintPass {
6463 $( #[ inline( always) ] fn $name( & mut self , _: & LateContext <' tcx>, $( _: $arg) ,* ) { } ) *
6564 }
@@ -79,7 +78,7 @@ macro_rules! expand_combined_late_lint_pass_method {
7978
8079#[ macro_export]
8180macro_rules! expand_combined_late_lint_pass_methods {
82- ( $passes: tt, [ $( $ ( # [ $attr : meta ] ) * fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
81+ ( $passes: tt, [ $( fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
8382 $( fn $name( & mut self , context: & $crate:: LateContext <' tcx>, $( $param: $arg) ,* ) {
8483 $crate:: expand_combined_late_lint_pass_method!( $passes, self , $name, ( context, $( $param) ,* ) ) ;
8584 } ) *
@@ -132,14 +131,13 @@ macro_rules! declare_combined_late_lint_pass {
132131#[ macro_export]
133132macro_rules! early_lint_methods {
134133 ( $macro: path, $args: tt) => (
134+ // `_post` methods are called *after* recursing into the node.
135135 $macro!( $args, [
136136 fn check_param( a: & rustc_ast:: Param ) ;
137137 fn check_ident( a: & rustc_span:: Ident ) ;
138138 fn check_crate( a: & rustc_ast:: Crate ) ;
139139 fn check_crate_post( a: & rustc_ast:: Crate ) ;
140140 fn check_item( a: & rustc_ast:: Item ) ;
141- /// This is called *after* recursing into the item
142- /// (in contrast to `check_item`, which is checked before).
143141 fn check_item_post( a: & rustc_ast:: Item ) ;
144142 fn check_local( a: & rustc_ast:: Local ) ;
145143 fn check_block( a: & rustc_ast:: Block ) ;
@@ -168,15 +166,14 @@ macro_rules! early_lint_methods {
168166 fn check_attributes_post( a: & [ rustc_ast:: Attribute ] ) ;
169167 fn check_mac_def( a: & rustc_ast:: MacroDef ) ;
170168 fn check_mac( a: & rustc_ast:: MacCall ) ;
171-
172- fn enter_where_predicate( a: & rustc_ast:: WherePredicate ) ;
173- fn exit_where_predicate( a: & rustc_ast:: WherePredicate ) ;
169+ fn check_where_predicate( a: & rustc_ast:: WherePredicate ) ;
170+ fn check_where_predicate_post( a: & rustc_ast:: WherePredicate ) ;
174171 ] ) ;
175172 )
176173}
177174
178175macro_rules! declare_early_lint_pass {
179- ( [ ] , [ $( $ ( # [ $attr : meta ] ) * fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
176+ ( [ ] , [ $( fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
180177 pub trait EarlyLintPass : LintPass {
181178 $( #[ inline( always) ] fn $name( & mut self , _: & EarlyContext <' _>, $( _: $arg) ,* ) { } ) *
182179 }
@@ -196,7 +193,7 @@ macro_rules! expand_combined_early_lint_pass_method {
196193
197194#[ macro_export]
198195macro_rules! expand_combined_early_lint_pass_methods {
199- ( $passes: tt, [ $( $ ( # [ $attr : meta ] ) * fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
196+ ( $passes: tt, [ $( fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
200197 $( fn $name( & mut self , context: & $crate:: EarlyContext <' _>, $( $param: $arg) ,* ) {
201198 $crate:: expand_combined_early_lint_pass_method!( $passes, self , $name, ( context, $( $param) ,* ) ) ;
202199 } ) *
@@ -247,5 +244,5 @@ macro_rules! declare_combined_early_lint_pass {
247244}
248245
249246/// A lint pass boxed up as a trait object.
250- pub ( crate ) type EarlyLintPassObject = Box < dyn EarlyLintPass + ' static > ;
247+ pub ( crate ) type EarlyLintPassObject = Box < dyn EarlyLintPass > ;
251248pub ( crate ) type LateLintPassObject < ' tcx > = Box < dyn LateLintPass < ' tcx > + ' tcx > ;
0 commit comments