@@ -598,6 +598,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
598598 ///
599599 /// In the meantime, though, callsites are required to deal with the "bug"
600600 /// locally in whichever way makes the most sense.
601+ #[ rustc_lint_diagnostics]
601602 #[ track_caller]
602603 pub fn downgrade_to_delayed_bug ( & mut self ) {
603604 assert ! (
@@ -631,13 +632,15 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
631632 with_fn ! { with_span_labels,
632633 /// Labels all the given spans with the provided label.
633634 /// See [`Self::span_label()`] for more information.
635+ #[ rustc_lint_diagnostics]
634636 pub fn span_labels( & mut self , spans: impl IntoIterator <Item = Span >, label: & str ) -> & mut Self {
635637 for span in spans {
636638 self . span_label( span, label. to_string( ) ) ;
637639 }
638640 self
639641 } }
640642
643+ #[ rustc_lint_diagnostics]
641644 pub fn replace_span_with ( & mut self , after : Span , keep_label : bool ) -> & mut Self {
642645 let before = self . span . clone ( ) ;
643646 self . span ( after) ;
@@ -653,6 +656,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
653656 self
654657 }
655658
659+ #[ rustc_lint_diagnostics]
656660 pub fn note_expected_found (
657661 & mut self ,
658662 expected_label : & dyn fmt:: Display ,
@@ -663,6 +667,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
663667 self . note_expected_found_extra ( expected_label, expected, found_label, found, & "" , & "" )
664668 }
665669
670+ #[ rustc_lint_diagnostics]
666671 pub fn note_expected_found_extra (
667672 & mut self ,
668673 expected_label : & dyn fmt:: Display ,
@@ -705,6 +710,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
705710 self
706711 }
707712
713+ #[ rustc_lint_diagnostics]
708714 pub fn note_trait_signature ( & mut self , name : Symbol , signature : String ) -> & mut Self {
709715 self . highlighted_note ( vec ! [
710716 StringPart :: normal( format!( "`{name}` from trait: `" ) ) ,
@@ -722,12 +728,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
722728 self
723729 } }
724730
731+ #[ rustc_lint_diagnostics]
725732 fn highlighted_note ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
726733 self . sub_with_highlights ( Level :: Note , msg, MultiSpan :: new ( ) ) ;
727734 self
728735 }
729736
730737 /// This is like [`Diag::note()`], but it's only printed once.
738+ #[ rustc_lint_diagnostics]
731739 pub fn note_once ( & mut self , msg : impl Into < SubdiagMessage > ) -> & mut Self {
732740 self . sub ( Level :: OnceNote , msg, MultiSpan :: new ( ) ) ;
733741 self
@@ -748,6 +756,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
748756
749757 /// Prints the span with a note above it.
750758 /// This is like [`Diag::note_once()`], but it gets its own span.
759+ #[ rustc_lint_diagnostics]
751760 pub fn span_note_once < S : Into < MultiSpan > > (
752761 & mut self ,
753762 sp : S ,
@@ -786,12 +795,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
786795 } }
787796
788797 /// This is like [`Diag::help()`], but it's only printed once.
798+ #[ rustc_lint_diagnostics]
789799 pub fn help_once ( & mut self , msg : impl Into < SubdiagMessage > ) -> & mut Self {
790800 self . sub ( Level :: OnceHelp , msg, MultiSpan :: new ( ) ) ;
791801 self
792802 }
793803
794804 /// Add a help message attached to this diagnostic with a customizable highlighted message.
805+ #[ rustc_lint_diagnostics]
795806 pub fn highlighted_help ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
796807 self . sub_with_highlights ( Level :: Help , msg, MultiSpan :: new ( ) ) ;
797808 self
@@ -812,12 +823,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
812823 /// Disallow attaching suggestions this diagnostic.
813824 /// Any suggestions attached e.g. with the `span_suggestion_*` methods
814825 /// (before and after the call to `disable_suggestions`) will be ignored.
826+ #[ rustc_lint_diagnostics]
815827 pub fn disable_suggestions ( & mut self ) -> & mut Self {
816828 self . suggestions = Err ( SuggestionsDisabled ) ;
817829 self
818830 }
819831
820832 /// Helper for pushing to `self.suggestions`, if available (not disable).
833+ #[ rustc_lint_diagnostics]
821834 fn push_suggestion ( & mut self , suggestion : CodeSuggestion ) {
822835 for subst in & suggestion. substitutions {
823836 for part in & subst. parts {
@@ -838,6 +851,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
838851 with_fn ! { with_multipart_suggestion,
839852 /// Show a suggestion that has multiple parts to it.
840853 /// In other words, multiple changes need to be applied as part of this suggestion.
854+ #[ rustc_lint_diagnostics]
841855 pub fn multipart_suggestion(
842856 & mut self ,
843857 msg: impl Into <SubdiagMessage >,
@@ -854,6 +868,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
854868
855869 /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
856870 /// In other words, multiple changes need to be applied as part of this suggestion.
871+ #[ rustc_lint_diagnostics]
857872 pub fn multipart_suggestion_verbose (
858873 & mut self ,
859874 msg : impl Into < SubdiagMessage > ,
@@ -869,6 +884,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
869884 }
870885
871886 /// [`Diag::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
887+ #[ rustc_lint_diagnostics]
872888 pub fn multipart_suggestion_with_style (
873889 & mut self ,
874890 msg : impl Into < SubdiagMessage > ,
@@ -911,6 +927,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
911927 /// be from the message, showing the span label inline would be visually unpleasant
912928 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
913929 /// improve understandability.
930+ #[ rustc_lint_diagnostics]
914931 pub fn tool_only_multipart_suggestion (
915932 & mut self ,
916933 msg : impl Into < SubdiagMessage > ,
@@ -943,6 +960,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
943960 /// * may contain a name of a function, variable, or type, but not whole expressions
944961 ///
945962 /// See `CodeSuggestion` for more information.
963+ #[ rustc_lint_diagnostics]
946964 pub fn span_suggestion(
947965 & mut self ,
948966 sp: Span ,
@@ -961,6 +979,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
961979 } }
962980
963981 /// [`Diag::span_suggestion()`] but you can set the [`SuggestionStyle`].
982+ #[ rustc_lint_diagnostics]
964983 pub fn span_suggestion_with_style (
965984 & mut self ,
966985 sp : Span ,
@@ -986,6 +1005,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
9861005
9871006 with_fn ! { with_span_suggestion_verbose,
9881007 /// Always show the suggested change.
1008+ #[ rustc_lint_diagnostics]
9891009 pub fn span_suggestion_verbose(
9901010 & mut self ,
9911011 sp: Span ,
@@ -1006,6 +1026,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10061026 with_fn ! { with_span_suggestions,
10071027 /// Prints out a message with multiple suggested edits of the code.
10081028 /// See also [`Diag::span_suggestion()`].
1029+ #[ rustc_lint_diagnostics]
10091030 pub fn span_suggestions(
10101031 & mut self ,
10111032 sp: Span ,
@@ -1022,6 +1043,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10221043 )
10231044 } }
10241045
1046+ #[ rustc_lint_diagnostics]
10251047 pub fn span_suggestions_with_style (
10261048 & mut self ,
10271049 sp : Span ,
@@ -1052,6 +1074,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10521074 /// Prints out a message with multiple suggested edits of the code, where each edit consists of
10531075 /// multiple parts.
10541076 /// See also [`Diag::multipart_suggestion()`].
1077+ #[ rustc_lint_diagnostics]
10551078 pub fn multipart_suggestions (
10561079 & mut self ,
10571080 msg : impl Into < SubdiagMessage > ,
@@ -1098,6 +1121,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10981121 /// inline, it will only show the message and not the suggestion.
10991122 ///
11001123 /// See `CodeSuggestion` for more information.
1124+ #[ rustc_lint_diagnostics]
11011125 pub fn span_suggestion_short(
11021126 & mut self ,
11031127 sp: Span ,
@@ -1121,6 +1145,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11211145 /// be from the message, showing the span label inline would be visually unpleasant
11221146 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
11231147 /// improve understandability.
1148+ #[ rustc_lint_diagnostics]
11241149 pub fn span_suggestion_hidden (
11251150 & mut self ,
11261151 sp : Span ,
@@ -1165,6 +1190,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11651190 /// [rustc_macros::Subdiagnostic]). Performs eager translation of any translatable messages
11661191 /// used in the subdiagnostic, so suitable for use with repeated messages (i.e. re-use of
11671192 /// interpolated variables).
1193+ #[ rustc_lint_diagnostics]
11681194 pub fn subdiagnostic (
11691195 & mut self ,
11701196 dcx : & crate :: DiagCtxt ,
@@ -1180,6 +1206,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11801206
11811207 with_fn ! { with_span,
11821208 /// Add a span.
1209+ #[ rustc_lint_diagnostics]
11831210 pub fn span( & mut self , sp: impl Into <MultiSpan >) -> & mut Self {
11841211 self . span = sp. into( ) ;
11851212 if let Some ( span) = self . span. primary_span( ) {
@@ -1188,27 +1215,31 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11881215 self
11891216 } }
11901217
1218+ #[ rustc_lint_diagnostics]
11911219 pub fn is_lint ( & mut self , name : String , has_future_breakage : bool ) -> & mut Self {
11921220 self . is_lint = Some ( IsLint { name, has_future_breakage } ) ;
11931221 self
11941222 }
11951223
11961224 with_fn ! { with_code,
11971225 /// Add an error code.
1226+ #[ rustc_lint_diagnostics]
11981227 pub fn code( & mut self , code: ErrCode ) -> & mut Self {
11991228 self . code = Some ( code) ;
12001229 self
12011230 } }
12021231
12031232 with_fn ! { with_primary_message,
12041233 /// Add a primary message.
1234+ #[ rustc_lint_diagnostics]
12051235 pub fn primary_message( & mut self , msg: impl Into <DiagMessage >) -> & mut Self {
12061236 self . messages[ 0 ] = ( msg. into( ) , Style :: NoStyle ) ;
12071237 self
12081238 } }
12091239
12101240 with_fn ! { with_arg,
12111241 /// Add an argument.
1242+ #[ rustc_lint_diagnostics]
12121243 pub fn arg(
12131244 & mut self ,
12141245 name: impl Into <DiagArgName >,
0 commit comments