File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -356,7 +356,14 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
356
356
let store = unerased_lint_store ( tcx. sess ) ;
357
357
358
358
if store. late_module_passes . is_empty ( ) {
359
- late_lint_mod_inner ( tcx, module_def_id, context, builtin_lints) ;
359
+ // If all builtin lints can be skipped, there is no point in running `late_lint_mod_inner`
360
+ // at all. This happens often for dependencies built with `--cap-lints=allow`.
361
+ let dont_need_to_run = tcx. lints_that_dont_need_to_run ( ( ) ) ;
362
+ let can_skip_lints =
363
+ builtin_lints. get_lints ( ) . iter ( ) . all ( |l| dont_need_to_run. contains ( & LintId :: of ( l) ) ) ;
364
+ if !can_skip_lints {
365
+ late_lint_mod_inner ( tcx, module_def_id, context, builtin_lints) ;
366
+ }
360
367
} else {
361
368
let builtin_lints = Box :: new ( builtin_lints) as Box < dyn LateLintPass < ' tcx > > ;
362
369
let mut binding = store
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ macro_rules! expand_combined_late_lint_pass_methods {
92
92
/// Combines multiple lints passes into a single lint pass, at compile time,
93
93
/// for maximum speed. Each `check_foo` method in `$methods` within this pass
94
94
/// simply calls `check_foo` once per `$pass`. Compare with
95
- /// `LateLintPassObjects `, which is similar, but combines lint passes at
95
+ /// `RuntimeCombinedLateLintPass `, which is similar, but combines lint passes at
96
96
/// runtime.
97
97
#[ macro_export]
98
98
macro_rules! declare_combined_late_lint_pass {
@@ -123,10 +123,10 @@ macro_rules! declare_combined_late_lint_pass {
123
123
#[ allow( rustc:: lint_pass_impl_without_macro) ]
124
124
impl $crate:: LintPass for $name {
125
125
fn name( & self ) -> & ' static str {
126
- panic! ( )
126
+ stringify! ( $name )
127
127
}
128
128
fn get_lints( & self ) -> LintVec {
129
- panic! ( )
129
+ $name :: get_lints ( )
130
130
}
131
131
}
132
132
)
You can’t perform that action at this time.
0 commit comments