@@ -72,18 +72,11 @@ late_lint_methods!(declare_late_lint_pass, []);
72
72
73
73
impl LateLintPass < ' _ > for HardwiredLints { }
74
74
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
-
82
75
#[ macro_export]
83
76
macro_rules! expand_combined_late_lint_pass_methods {
84
77
( $passes: tt, [ $( $( #[ $attr: meta] ) * fn $name: ident( $( $param: ident: $arg: ty) ,* ) ; ) * ] ) => (
85
78
$( 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) * ) ;
87
80
} ) *
88
81
)
89
82
}
@@ -97,15 +90,15 @@ macro_rules! expand_combined_late_lint_pass_methods {
97
90
macro_rules! declare_combined_late_lint_pass {
98
91
( [ $v: vis $name: ident, [ $( $pass: ident: $constructor: expr, ) * ] ] , $methods: tt) => (
99
92
#[ allow( non_snake_case) ]
100
- $v struct $name {
101
- $ ( $pass : $pass , ) *
93
+ $v struct $name< ' tcx> {
94
+ inner : RuntimeCombinedLateLintPass < ' tcx> ,
102
95
}
103
96
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 } }
109
102
}
110
103
111
104
$v fn get_lints( ) -> $crate:: LintVec {
@@ -115,12 +108,12 @@ macro_rules! declare_combined_late_lint_pass {
115
108
}
116
109
}
117
110
118
- impl <' tcx> $crate:: LateLintPass <' tcx> for $name {
111
+ impl <' tcx> $crate:: LateLintPass <' tcx> for $name< ' tcx> {
119
112
$crate:: expand_combined_late_lint_pass_methods!( [ $( $pass) ,* ] , $methods) ;
120
113
}
121
114
122
115
#[ allow( rustc:: lint_pass_impl_without_macro) ]
123
- impl $crate:: LintPass for $name {
116
+ impl $crate:: LintPass for $name< ' _> {
124
117
fn name( & self ) -> & ' static str {
125
118
panic!( )
126
119
}
0 commit comments