@@ -22,7 +22,7 @@ use rustc_ast::visit::{FnCtxt, FnKind};
2222use rustc_ast:: { self as ast, * } ;
2323use rustc_ast_pretty:: pprust:: expr_to_string;
2424use rustc_attr_parsing:: AttributeParser ;
25- use rustc_errors:: { Applicability , LintDiagnostic , msg} ;
25+ use rustc_errors:: { Applicability , Diagnostic , msg} ;
2626use rustc_feature:: GateIssue ;
2727use rustc_hir as hir;
2828use rustc_hir:: attrs:: { AttributeKind , DocAttribute } ;
@@ -100,7 +100,7 @@ impl EarlyLintPass for WhileTrue {
100100 "{}loop" ,
101101 label. map_or_else( String :: new, |label| format!( "{}: " , label. ident, ) )
102102 ) ;
103- cx. emit_span_lint (
103+ cx. emit_span_diag_lint (
104104 WHILE_TRUE ,
105105 condition_span,
106106 BuiltinWhileTrue { suggestion : condition_span, replace } ,
@@ -173,7 +173,7 @@ impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns {
173173 if cx. tcx . find_field_index ( ident, variant)
174174 == Some ( cx. typeck_results ( ) . field_index ( fieldpat. hir_id ) )
175175 {
176- cx. emit_span_lint (
176+ cx. emit_span_diag_lint (
177177 NON_SHORTHAND_FIELD_PATTERNS ,
178178 fieldpat. span ,
179179 BuiltinNonShorthandFieldPatterns {
@@ -236,14 +236,14 @@ impl UnsafeCode {
236236 & self ,
237237 cx : & EarlyContext < ' _ > ,
238238 span : Span ,
239- decorate : impl for < ' a > LintDiagnostic < ' a , ( ) > ,
239+ decorate : impl for < ' a > Diagnostic < ' a , ( ) > ,
240240 ) {
241241 // This comes from a macro that has `#[allow_internal_unsafe]`.
242242 if span. allows_unsafe ( ) {
243243 return ;
244244 }
245245
246- cx. emit_span_lint ( UNSAFE_CODE , span, decorate) ;
246+ cx. emit_span_diag_lint ( UNSAFE_CODE , span, decorate) ;
247247 }
248248}
249249
@@ -424,7 +424,7 @@ impl MissingDoc {
424424 let attrs = cx. tcx . hir_attrs ( cx. tcx . local_def_id_to_hir_id ( def_id) ) ;
425425 let has_doc = attrs. iter ( ) . any ( has_doc) ;
426426 if !has_doc {
427- cx. emit_span_lint (
427+ cx. emit_span_diag_lint (
428428 MISSING_DOCS ,
429429 cx. tcx . def_span ( def_id) ,
430430 BuiltinMissingDoc { article, desc } ,
@@ -625,7 +625,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
625625 )
626626 . is_ok ( )
627627 {
628- cx. emit_span_lint ( MISSING_COPY_IMPLEMENTATIONS , item. span , BuiltinMissingCopyImpl ) ;
628+ cx. emit_span_diag_lint ( MISSING_COPY_IMPLEMENTATIONS , item. span , BuiltinMissingCopyImpl ) ;
629629 }
630630 }
631631}
@@ -712,7 +712,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
712712 . next ( )
713713 . is_some ( ) ;
714714 if !has_impl {
715- cx. emit_span_lint (
715+ cx. emit_span_diag_lint (
716716 MISSING_DEBUG_IMPLEMENTATIONS ,
717717 item. span ,
718718 BuiltinMissingDebugImpl { tcx : cx. tcx , def_id : debug } ,
@@ -789,7 +789,7 @@ impl EarlyLintPass for AnonymousParameters {
789789 } else {
790790 ( "<type>" , Applicability :: HasPlaceholders )
791791 } ;
792- cx. emit_span_lint (
792+ cx. emit_span_diag_lint (
793793 ANONYMOUS_PARAMETERS ,
794794 arg. pat . span ,
795795 BuiltinAnonymousParams { suggestion : ( arg. pat . span , appl) , ty_snip } ,
@@ -834,7 +834,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
834834 BuiltinUnusedDocCommentSub :: BlockHelp
835835 }
836836 } ;
837- cx. emit_span_lint (
837+ cx. emit_span_diag_lint (
838838 UNUSED_DOC_COMMENTS ,
839839 span,
840840 BuiltinUnusedDocComment { kind : node_kind, label : node_span, sub } ,
@@ -966,7 +966,7 @@ impl InvalidNoMangleItems {
966966 ) {
967967 let generics = cx. tcx . generics_of ( def_id) ;
968968 if generics. requires_monomorphization ( cx. tcx ) {
969- cx. emit_span_lint (
969+ cx. emit_span_diag_lint (
970970 NO_MANGLE_GENERIC_ITEMS ,
971971 cx. tcx . def_span ( def_id) ,
972972 BuiltinNoMangleGeneric { suggestion : attr_span } ,
@@ -998,7 +998,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
998998
999999 // Const items do not refer to a particular location in memory, and therefore
10001000 // don't have anything to attach a symbol to
1001- cx. emit_span_lint (
1001+ cx. emit_span_diag_lint (
10021002 NO_MANGLE_CONST_ITEMS ,
10031003 it. span ,
10041004 BuiltinConstNoMangle { suggestion } ,
@@ -1059,7 +1059,7 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes {
10591059 get_transmute_from_to ( cx, expr) . map ( |( ty1, ty2) | ( ty1. kind ( ) , ty2. kind ( ) ) )
10601060 {
10611061 if from_mutbl < to_mutbl {
1062- cx. emit_span_lint ( MUTABLE_TRANSMUTES , expr. span , BuiltinMutablesTransmutes ) ;
1062+ cx. emit_span_diag_lint ( MUTABLE_TRANSMUTES , expr. span , BuiltinMutablesTransmutes ) ;
10631063 }
10641064 }
10651065
@@ -1123,7 +1123,7 @@ impl<'tcx> LateLintPass<'tcx> for UnstableFeatures {
11231123 fn check_attributes ( & mut self , cx : & LateContext < ' _ > , attrs : & [ hir:: Attribute ] ) {
11241124 if let Some ( features) = find_attr ! ( attrs, Feature ( features, _) => features) {
11251125 for feature in features {
1126- cx. emit_span_lint ( UNSTABLE_FEATURES , feature. span , BuiltinUnstableFeatures ) ;
1126+ cx. emit_span_diag_lint ( UNSTABLE_FEATURES , feature. span , BuiltinUnstableFeatures ) ;
11271127 }
11281128 }
11291129 }
@@ -1176,7 +1176,7 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
11761176 // Now, check if the function has the `#[track_caller]` attribute
11771177 && let Some ( attr_span) = find_attr ! ( cx. tcx, def_id, TrackCaller ( span) => * span)
11781178 {
1179- cx. emit_span_lint (
1179+ cx. emit_span_diag_lint (
11801180 UNGATED_ASYNC_FN_TRACK_CALLER ,
11811181 attr_span,
11821182 BuiltinUngatedAsyncFnTrackCaller { label : span, session : & cx. tcx . sess } ,
@@ -1261,7 +1261,7 @@ impl UnreachablePub {
12611261 applicability = Applicability :: MaybeIncorrect ;
12621262 }
12631263 let def_span = cx. tcx . def_span ( def_id) ;
1264- cx. emit_span_lint (
1264+ cx. emit_span_diag_lint (
12651265 UNREACHABLE_PUB ,
12661266 def_span,
12671267 BuiltinUnreachablePub {
@@ -1413,7 +1413,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
14131413 let enable_feat_help = cx. tcx . sess . is_nightly_build ( ) ;
14141414
14151415 if let [ .., label_sp] = * where_spans {
1416- cx. emit_span_lint (
1416+ cx. emit_span_diag_lint (
14171417 TYPE_ALIAS_BOUNDS ,
14181418 where_spans,
14191419 BuiltinTypeAliasBounds {
@@ -1427,7 +1427,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
14271427 ) ;
14281428 }
14291429 if let [ .., label_sp] = * inline_spans {
1430- cx. emit_span_lint (
1430+ cx. emit_span_diag_lint (
14311431 TYPE_ALIAS_BOUNDS ,
14321432 inline_spans,
14331433 BuiltinTypeAliasBounds {
@@ -1527,7 +1527,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
15271527 | ty:: ClauseKind :: HostEffect ( ..) => continue ,
15281528 } ;
15291529 if predicate. is_global ( ) {
1530- cx. emit_span_lint (
1530+ cx. emit_span_diag_lint (
15311531 TRIVIAL_BOUNDS ,
15321532 span,
15331533 BuiltinTrivialBounds { predicate_kind_name, predicate } ,
@@ -1582,7 +1582,7 @@ impl EarlyLintPass for DoubleNegations {
15821582 // Don't lint if this jumps macro expansion boundary (Issue #143980)
15831583 && expr. span . eq_ctxt ( inner. span )
15841584 {
1585- cx. emit_span_lint (
1585+ cx. emit_span_diag_lint (
15861586 DOUBLE_NEGATIONS ,
15871587 expr. span ,
15881588 BuiltinDoubleNegations {
@@ -1703,7 +1703,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17031703 replace,
17041704 } ) ;
17051705 } else {
1706- cx. emit_span_lint (
1706+ cx. emit_span_diag_lint (
17071707 ELLIPSIS_INCLUSIVE_RANGE_PATTERNS ,
17081708 pat. span ,
17091709 BuiltinEllipsisInclusiveRangePatternsLint :: Parenthesise {
@@ -1721,7 +1721,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17211721 replace : replace. to_string ( ) ,
17221722 } ) ;
17231723 } else {
1724- cx. emit_span_lint (
1724+ cx. emit_span_diag_lint (
17251725 ELLIPSIS_INCLUSIVE_RANGE_PATTERNS ,
17261726 join,
17271727 BuiltinEllipsisInclusiveRangePatternsLint :: NonParenthesise {
@@ -1903,7 +1903,7 @@ impl KeywordIdents {
19031903 return ;
19041904 }
19051905
1906- cx. emit_span_lint (
1906+ cx. emit_span_diag_lint (
19071907 lint,
19081908 ident. span ,
19091909 BuiltinKeywordIdents { kw : ident, next : edition, suggestion : ident. span , prefix } ,
@@ -2239,7 +2239,7 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
22392239 lint_spans. sort_unstable ( ) ;
22402240 lint_spans. dedup ( ) ;
22412241
2242- cx. emit_span_lint (
2242+ cx. emit_span_diag_lint (
22432243 EXPLICIT_OUTLIVES_REQUIREMENTS ,
22442244 lint_spans. clone ( ) ,
22452245 BuiltinExplicitOutlives {
@@ -2324,13 +2324,17 @@ impl EarlyLintPass for IncompleteInternalFeatures {
23242324 let help =
23252325 HAS_MIN_FEATURES . contains ( & name) . then_some ( BuiltinIncompleteFeaturesHelp ) ;
23262326
2327- cx. emit_span_lint (
2327+ cx. emit_span_diag_lint (
23282328 INCOMPLETE_FEATURES ,
23292329 span,
23302330 BuiltinIncompleteFeatures { name, note, help } ,
23312331 ) ;
23322332 } else {
2333- cx. emit_span_lint ( INTERNAL_FEATURES , span, BuiltinInternalFeatures { name } ) ;
2333+ cx. emit_span_diag_lint (
2334+ INTERNAL_FEATURES ,
2335+ span,
2336+ BuiltinInternalFeatures { name } ,
2337+ ) ;
23342338 }
23352339 } ) ;
23362340 }
@@ -2656,7 +2660,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26562660 }
26572661 } ;
26582662 let sub = BuiltinUnpermittedTypeInitSub { err } ;
2659- cx. emit_span_lint (
2663+ cx. emit_span_diag_lint (
26602664 INVALID_VALUE ,
26612665 expr. span ,
26622666 BuiltinUnpermittedTypeInit {
@@ -2762,7 +2766,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
27622766 {
27632767 // `&raw *NULL` is ok.
27642768 } else {
2765- cx. emit_span_lint (
2769+ cx. emit_span_diag_lint (
27662770 DEREF_NULLPTR ,
27672771 expr. span ,
27682772 BuiltinDerefNullptr { label : expr. span } ,
@@ -3071,14 +3075,14 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
30713075 let span = span. unwrap_or ( * template_span) ;
30723076 match label_kind {
30733077 AsmLabelKind :: Named => {
3074- cx. emit_span_lint (
3078+ cx. emit_span_diag_lint (
30753079 NAMED_ASM_LABELS ,
30763080 span,
30773081 InvalidAsmLabel :: Named { missing_precise_span } ,
30783082 ) ;
30793083 }
30803084 AsmLabelKind :: FormatArg => {
3081- cx. emit_span_lint (
3085+ cx. emit_span_diag_lint (
30823086 NAMED_ASM_LABELS ,
30833087 span,
30843088 InvalidAsmLabel :: FormatArg { missing_precise_span } ,
@@ -3092,7 +3096,7 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
30923096 Some ( InlineAsmArch :: X86 | InlineAsmArch :: X86_64 ) | None
30933097 ) =>
30943098 {
3095- cx. emit_span_lint (
3099+ cx. emit_span_diag_lint (
30963100 BINARY_ASM_LABELS ,
30973101 span,
30983102 InvalidAsmLabel :: Binary { missing_precise_span, span } ,
@@ -3168,12 +3172,12 @@ impl EarlyLintPass for SpecialModuleName {
31683172 }
31693173
31703174 match ident. name . as_str ( ) {
3171- "lib" => cx. emit_span_lint (
3175+ "lib" => cx. emit_span_diag_lint (
31723176 SPECIAL_MODULE_NAME ,
31733177 item. span ,
31743178 BuiltinSpecialModuleNameUsed :: Lib ,
31753179 ) ,
3176- "main" => cx. emit_span_lint (
3180+ "main" => cx. emit_span_diag_lint (
31773181 SPECIAL_MODULE_NAME ,
31783182 item. span ,
31793183 BuiltinSpecialModuleNameUsed :: Main ,
0 commit comments