@@ -10,8 +10,8 @@ use rustc_ast::{self as ast, HasAttrs};
1010use rustc_data_structures:: stack:: ensure_sufficient_stack;
1111use rustc_feature:: Features ;
1212use rustc_middle:: ty:: { RegisteredTools , TyCtxt } ;
13- use rustc_session:: Session ;
1413use rustc_session:: lint:: { BufferedEarlyLint , LintBuffer , LintPass } ;
14+ use rustc_session:: { Session , lint} ;
1515use rustc_span:: { Ident , Span } ;
1616use tracing:: debug;
1717
@@ -319,6 +319,7 @@ pub fn check_ast_node<'a>(
319319 registered_tools : & RegisteredTools ,
320320 lint_buffer : Option < LintBuffer > ,
321321 builtin_lints : impl EarlyLintPass + ' static ,
322+ builtin_lints_2 : Option < impl EarlyLintPass + ' static > ,
322323 check_node : impl EarlyCheckNode < ' a > ,
323324) {
324325 let context = EarlyContext :: new (
@@ -336,6 +337,14 @@ pub fn check_ast_node<'a>(
336337 let passes =
337338 if pre_expansion { & lint_store. pre_expansion_passes } else { & lint_store. early_passes } ;
338339 if passes. is_empty ( ) {
340+ if let Some ( tcx) = tcx {
341+ if sess. opts . lint_cap . is_some_and ( |cap| cap == lint:: Allow ) {
342+ if let Some ( builtin_lints_2) = builtin_lints_2 {
343+ check_ast_node_inner ( sess, Some ( tcx) , check_node, context, builtin_lints_2) ;
344+ return ;
345+ }
346+ }
347+ }
339348 check_ast_node_inner ( sess, tcx, check_node, context, builtin_lints) ;
340349 } else {
341350 let mut passes: Vec < _ > = passes. iter ( ) . map ( |mk_pass| ( mk_pass) ( ) ) . collect ( ) ;
0 commit comments