77use rustc_ast:: ptr:: P ;
88use rustc_ast:: visit:: { self as ast_visit, Visitor , walk_list} ;
99use rustc_ast:: { self as ast, HasAttrs } ;
10- use rustc_data_structures:: fx:: FxHashSet ;
1110use rustc_data_structures:: stack:: ensure_sufficient_stack;
1211use rustc_feature:: Features ;
13- use rustc_hir:: { HirId , ItemLocalId , OwnerId } ;
14- use rustc_middle:: hir;
15- use rustc_middle:: lint:: LintLevelSource ;
1612use rustc_middle:: ty:: { RegisteredTools , TyCtxt } ;
1713use rustc_session:: lint:: { BufferedEarlyLint , LintBuffer , LintPass } ;
1814use rustc_session:: { Session , lint} ;
19- use rustc_span:: def_id:: CRATE_DEF_ID ;
2015use rustc_span:: { Ident , Span } ;
2116use tracing:: debug;
2217
23- use crate :: builtin:: UnsafeCode ;
2418use crate :: context:: { EarlyContext , LintContext , LintStore } ;
2519use crate :: passes:: { EarlyLintPass , EarlyLintPassObject } ;
26- use crate :: { Level , LintId } ;
2720
2821pub ( super ) mod diagnostics;
2922
@@ -326,6 +319,7 @@ pub fn check_ast_node<'a>(
326319 registered_tools : & RegisteredTools ,
327320 lint_buffer : Option < LintBuffer > ,
328321 builtin_lints : impl EarlyLintPass + ' static ,
322+ builtin_lints_2 : Option < impl EarlyLintPass + ' static > ,
329323 check_node : impl EarlyCheckNode < ' a > ,
330324) {
331325 let context = EarlyContext :: new (
@@ -345,23 +339,8 @@ pub fn check_ast_node<'a>(
345339 if passes. is_empty ( ) {
346340 if let Some ( tcx) = tcx {
347341 if sess. opts . lint_cap . is_some_and ( |cap| cap == lint:: Allow ) {
348- let lints_that_must_run = builtin_lints
349- . get_lints ( )
350- . into_iter ( )
351- . filter ( |lint| {
352- let has_future_breakage = lint
353- . future_incompatible
354- . is_some_and ( |fut| fut. reason . has_future_breakage ( ) ) ;
355- has_future_breakage || lint. eval_always
356- } )
357- . collect :: < Vec < _ > > ( ) ;
358- eprintln ! (
359- "LINT: must_run: {}, total: {}" ,
360- lints_that_must_run. len( ) ,
361- builtin_lints. get_lints( ) . len( )
362- ) ;
363- if !lints_that_must_run. is_empty ( ) {
364- check_ast_node_inner ( sess, Some ( tcx) , check_node, context, UnsafeCode ) ;
342+ if let Some ( builtin_lints_2) = builtin_lints_2 {
343+ check_ast_node_inner ( sess, Some ( tcx) , check_node, context, builtin_lints_2) ;
365344 return ;
366345 }
367346 }
0 commit comments