@@ -72,18 +72,11 @@ late_lint_methods!(declare_late_lint_pass, []);
7272
7373impl LateLintPass < ' _ > for HardwiredLints { }
7474
75- #[ macro_export]
76- macro_rules! expand_combined_late_lint_pass_method {
77- ( [ $( $pass: ident) ,* ] , $self: ident, $name: ident, $params: tt) => ( {
78- $( $self. $pass. $name $params; ) *
79- } )
80- }
81-
8275#[ macro_export]
8376macro_rules! expand_combined_late_lint_pass_methods {
8477 ( $passes: tt, [ $( $( #[ $attr: meta] ) * fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
8578 $( fn $name( & mut self , context: & $crate:: LateContext <' tcx>, $( $param: $arg) ,* ) {
86- $crate :: expand_combined_late_lint_pass_method! ( $passes , self , $name, ( context, $( $ param) , * ) ) ;
79+ self . inner . $name( context$ ( , $param) * ) ;
8780 } ) *
8881 )
8982}
@@ -97,15 +90,15 @@ macro_rules! expand_combined_late_lint_pass_methods {
9790macro_rules! declare_combined_late_lint_pass {
9891 ( [ $v: vis $name: ident, [ $( $pass: ident: $constructor: expr, ) * ] ] , $methods: tt) => (
9992 #[ allow( non_snake_case) ]
100- $v struct $name {
101- $ ( $pass : $pass , ) *
93+ $v struct $name< ' tcx> {
94+ inner : RuntimeCombinedLateLintPass < ' tcx> ,
10295 }
10396
104- impl $name {
105- $v fn new( ) -> Self {
106- Self {
107- $ ( $pass : $constructor, ) *
108- }
97+ impl < ' tcx> $name< ' tcx> {
98+ $v fn new( _tcx : TyCtxt < ' tcx> ) -> Self {
99+ let mut passes = vec! [ ] ;
100+ $ ( passes . push ( Box :: new ( $constructor) as Box <dyn LateLintPass < ' tcx>> ) ; ) *
101+ $name { inner : RuntimeCombinedLateLintPass { passes } }
109102 }
110103
111104 $v fn get_lints( ) -> $crate:: LintVec {
@@ -115,12 +108,12 @@ macro_rules! declare_combined_late_lint_pass {
115108 }
116109 }
117110
118- impl <' tcx> $crate:: LateLintPass <' tcx> for $name {
111+ impl <' tcx> $crate:: LateLintPass <' tcx> for $name< ' tcx> {
119112 $crate:: expand_combined_late_lint_pass_methods!( [ $( $pass) ,* ] , $methods) ;
120113 }
121114
122115 #[ allow( rustc:: lint_pass_impl_without_macro) ]
123- impl $crate:: LintPass for $name {
116+ impl $crate:: LintPass for $name< ' _> {
124117 fn name( & self ) -> & ' static str {
125118 panic!( )
126119 }
0 commit comments