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 ;
44use 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 ;
67use rustc_session:: lint:: LintExpectationId ;
78use rustc_span:: symbol:: sym;
89use rustc_span:: Symbol ;
@@ -28,34 +29,15 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
2829 if !fulfilled_expectations. contains ( & id)
2930 && tool_filter. map_or ( true , |filter| expectation. lint_tool == Some ( filter) )
3031 {
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+ ) ;
3238 }
3339 } else {
3440 unreachable ! ( "at this stage all `LintExpectationId`s are stable" ) ;
3541 }
3642 }
3743}
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