1
- use crate :: builtin ;
2
- use rustc_errors :: fluent ;
3
- use rustc_hir :: HirId ;
1
+ #! [ deny ( rustc :: untranslatable_diagnostic ) ]
2
+ #! [ deny ( rustc :: diagnostic_outside_of_impl ) ]
3
+ use crate :: lints :: Expectation ;
4
4
use rustc_middle:: ty:: query:: Providers ;
5
- use rustc_middle:: { lint:: LintExpectation , ty:: TyCtxt } ;
5
+ use rustc_middle:: ty:: TyCtxt ;
6
+ use rustc_session:: lint:: builtin:: UNFULFILLED_LINT_EXPECTATIONS ;
6
7
use rustc_session:: lint:: LintExpectationId ;
7
8
use rustc_span:: symbol:: sym;
8
9
use rustc_span:: Symbol ;
@@ -28,34 +29,15 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
28
29
if !fulfilled_expectations. contains ( & id)
29
30
&& tool_filter. map_or ( true , |filter| expectation. lint_tool == Some ( filter) )
30
31
{
31
- emit_unfulfilled_expectation_lint ( tcx, * hir_id, expectation) ;
32
+ tcx. emit_spanned_lint (
33
+ UNFULFILLED_LINT_EXPECTATIONS ,
34
+ * hir_id,
35
+ expectation. emission_span ,
36
+ Expectation { expectation } ,
37
+ ) ;
32
38
}
33
39
} else {
34
40
unreachable ! ( "at this stage all `LintExpectationId`s are stable" ) ;
35
41
}
36
42
}
37
43
}
38
-
39
- fn emit_unfulfilled_expectation_lint (
40
- tcx : TyCtxt < ' _ > ,
41
- hir_id : HirId ,
42
- expectation : & LintExpectation ,
43
- ) {
44
- tcx. struct_span_lint_hir (
45
- builtin:: UNFULFILLED_LINT_EXPECTATIONS ,
46
- hir_id,
47
- expectation. emission_span ,
48
- fluent:: lint_expectation,
49
- |lint| {
50
- if let Some ( rationale) = expectation. reason {
51
- lint. note ( rationale. as_str ( ) ) ;
52
- }
53
-
54
- if expectation. is_unfulfilled_lint_expectations {
55
- lint. note ( fluent:: note) ;
56
- }
57
-
58
- lint
59
- } ,
60
- ) ;
61
- }
0 commit comments