File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -356,7 +356,16 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
356356 let store = unerased_lint_store ( tcx. sess ) ;
357357
358358 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 = builtin_lints
363+ . get_lints ( )
364+ . iter ( )
365+ . all ( |lint| dont_need_to_run. contains ( & LintId :: of ( lint) ) ) ;
366+ if !can_skip_lints {
367+ late_lint_mod_inner ( tcx, module_def_id, context, builtin_lints) ;
368+ }
360369 } else {
361370 let builtin_lints = Box :: new ( builtin_lints) as Box < dyn LateLintPass < ' tcx > > ;
362371 let mut binding = store
Original file line number Diff line number Diff line change @@ -123,10 +123,10 @@ macro_rules! declare_combined_late_lint_pass {
123123 #[ allow( rustc:: lint_pass_impl_without_macro) ]
124124 impl $crate:: LintPass for $name {
125125 fn name( & self ) -> & ' static str {
126- panic! ( )
126+ stringify! ( $name )
127127 }
128128 fn get_lints( & self ) -> LintVec {
129- panic! ( )
129+ $name :: get_lints ( )
130130 }
131131 }
132132 )
You can’t perform that action at this time.
0 commit comments