@@ -8,16 +8,14 @@ use rustc_ast::ptr::P;
8
8
use rustc_ast:: visit:: { self as ast_visit, Visitor , walk_list} ;
9
9
use rustc_ast:: { self as ast, HasAttrs } ;
10
10
use rustc_data_structures:: stack:: ensure_sufficient_stack;
11
- use rustc_errors:: MultiSpan ;
12
11
use rustc_feature:: Features ;
13
12
use rustc_middle:: ty:: { RegisteredTools , TyCtxt } ;
14
13
use rustc_session:: Session ;
15
- use rustc_session:: lint:: { BufferedEarlyLint , BuiltinLintDiag , LintBuffer , LintPass } ;
14
+ use rustc_session:: lint:: { BufferedEarlyLint , LintBuffer , LintPass } ;
16
15
use rustc_span:: Span ;
17
16
use rustc_span:: symbol:: Ident ;
18
17
use tracing:: debug;
19
18
20
- use crate :: Lint ;
21
19
use crate :: context:: { EarlyContext , LintContext , LintStore } ;
22
20
use crate :: passes:: { EarlyLintPass , EarlyLintPassObject } ;
23
21
@@ -35,46 +33,16 @@ pub struct EarlyContextAndPass<'a, 'b, T: EarlyLintPass> {
35
33
pass : T ,
36
34
}
37
35
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
-
70
36
impl < ' a , ' b , T : EarlyLintPass > EarlyContextAndPass < ' a , ' b , T > {
71
37
// This always-inlined function is for the hot call site.
72
38
#[ inline( always) ]
73
39
#[ allow( rustc:: diagnostic_outside_of_impl) ]
74
40
fn inlined_check_id ( & mut self , id : ast:: NodeId ) {
75
41
for early_lint in self . context . buffered . take ( id) {
76
42
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
+ } ) ;
78
46
}
79
47
}
80
48
0 commit comments