@@ -8,16 +8,14 @@ use rustc_ast::ptr::P;
88use rustc_ast:: visit:: { self as ast_visit, Visitor , walk_list} ;
99use rustc_ast:: { self as ast, HasAttrs } ;
1010use rustc_data_structures:: stack:: ensure_sufficient_stack;
11- use rustc_errors:: MultiSpan ;
1211use rustc_feature:: Features ;
1312use rustc_middle:: ty:: { RegisteredTools , TyCtxt } ;
1413use rustc_session:: Session ;
15- use rustc_session:: lint:: { BufferedEarlyLint , BuiltinLintDiag , LintBuffer , LintPass } ;
14+ use rustc_session:: lint:: { BufferedEarlyLint , LintBuffer , LintPass } ;
1615use rustc_span:: Span ;
1716use rustc_span:: symbol:: Ident ;
1817use tracing:: debug;
1918
20- use crate :: Lint ;
2119use crate :: context:: { EarlyContext , LintContext , LintStore } ;
2220use crate :: passes:: { EarlyLintPass , EarlyLintPassObject } ;
2321
@@ -35,46 +33,16 @@ pub struct EarlyContextAndPass<'a, 'b, T: EarlyLintPass> {
3533 pass : T ,
3634}
3735
38- impl < T : EarlyLintPass > EarlyContextAndPass < ' _ , ' _ , T > {
39- /// Emit a lint at the appropriate level, with an associated span and an existing
40- /// diagnostic.
41- ///
42- /// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
43- #[ rustc_lint_diagnostics]
44- pub fn span_lint_with_diagnostics (
45- & self ,
46- lint : & ' static Lint ,
47- span : MultiSpan ,
48- diagnostic : BuiltinLintDiag ,
49- ) {
50- self . opt_span_lint_with_diagnostics ( lint, Some ( span) , diagnostic) ;
51- }
52-
53- /// Emit a lint at the appropriate level, with an optional associated span and an existing
54- /// diagnostic.
55- ///
56- /// [`lint_level`]: rustc_middle::lint::lint_level#decorate-signature
57- #[ rustc_lint_diagnostics]
58- pub fn opt_span_lint_with_diagnostics (
59- & self ,
60- lint : & ' static Lint ,
61- span : Option < MultiSpan > ,
62- diagnostic : BuiltinLintDiag ,
63- ) {
64- self . context . opt_span_lint ( lint, span, |diag| {
65- diagnostics:: decorate_lint ( self . context . sess ( ) , self . tcx , diagnostic, diag) ;
66- } ) ;
67- }
68- }
69-
7036impl < ' a , ' b , T : EarlyLintPass > EarlyContextAndPass < ' a , ' b , T > {
7137 // This always-inlined function is for the hot call site.
7238 #[ inline( always) ]
7339 #[ allow( rustc:: diagnostic_outside_of_impl) ]
7440 fn inlined_check_id ( & mut self , id : ast:: NodeId ) {
7541 for early_lint in self . context . buffered . take ( id) {
7642 let BufferedEarlyLint { span, node_id : _, lint_id, diagnostic } = early_lint;
77- self . opt_span_lint_with_diagnostics ( lint_id. lint , span, diagnostic) ;
43+ self . context . opt_span_lint ( lint_id. lint , span, |diag| {
44+ diagnostics:: decorate_lint ( self . context . sess ( ) , self . tcx , diagnostic, diag) ;
45+ } ) ;
7846 }
7947 }
8048
0 commit comments