@@ -599,6 +599,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
599599 ///
600600 /// In the meantime, though, callsites are required to deal with the "bug"
601601 /// locally in whichever way makes the most sense.
602+ #[ rustc_lint_diagnostics]
602603 #[ track_caller]
603604 pub fn downgrade_to_delayed_bug ( & mut self ) {
604605 assert ! (
@@ -632,13 +633,15 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
632633 with_fn ! { with_span_labels,
633634 /// Labels all the given spans with the provided label.
634635 /// See [`Self::span_label()`] for more information.
636+ #[ rustc_lint_diagnostics]
635637 pub fn span_labels( & mut self , spans: impl IntoIterator <Item = Span >, label: & str ) -> & mut Self {
636638 for span in spans {
637639 self . span_label( span, label. to_string( ) ) ;
638640 }
639641 self
640642 } }
641643
644+ #[ rustc_lint_diagnostics]
642645 pub fn replace_span_with ( & mut self , after : Span , keep_label : bool ) -> & mut Self {
643646 let before = self . span . clone ( ) ;
644647 self . span ( after) ;
@@ -654,6 +657,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
654657 self
655658 }
656659
660+ #[ rustc_lint_diagnostics]
657661 pub fn note_expected_found (
658662 & mut self ,
659663 expected_label : & dyn fmt:: Display ,
@@ -664,6 +668,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
664668 self . note_expected_found_extra ( expected_label, expected, found_label, found, & "" , & "" )
665669 }
666670
671+ #[ rustc_lint_diagnostics]
667672 pub fn note_expected_found_extra (
668673 & mut self ,
669674 expected_label : & dyn fmt:: Display ,
@@ -706,6 +711,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
706711 self
707712 }
708713
714+ #[ rustc_lint_diagnostics]
709715 pub fn note_trait_signature ( & mut self , name : Symbol , signature : String ) -> & mut Self {
710716 self . highlighted_note ( vec ! [
711717 StringPart :: normal( format!( "`{name}` from trait: `" ) ) ,
@@ -723,12 +729,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
723729 self
724730 } }
725731
732+ #[ rustc_lint_diagnostics]
726733 fn highlighted_note ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
727734 self . sub_with_highlights ( Level :: Note , msg, MultiSpan :: new ( ) ) ;
728735 self
729736 }
730737
731738 /// This is like [`Diag::note()`], but it's only printed once.
739+ #[ rustc_lint_diagnostics]
732740 pub fn note_once ( & mut self , msg : impl Into < SubdiagnosticMessage > ) -> & mut Self {
733741 self . sub ( Level :: OnceNote , msg, MultiSpan :: new ( ) ) ;
734742 self
@@ -749,6 +757,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
749757
750758 /// Prints the span with a note above it.
751759 /// This is like [`Diag::note_once()`], but it gets its own span.
760+ #[ rustc_lint_diagnostics]
752761 pub fn span_note_once < S : Into < MultiSpan > > (
753762 & mut self ,
754763 sp : S ,
@@ -787,12 +796,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
787796 } }
788797
789798 /// This is like [`Diag::help()`], but it's only printed once.
799+ #[ rustc_lint_diagnostics]
790800 pub fn help_once ( & mut self , msg : impl Into < SubdiagnosticMessage > ) -> & mut Self {
791801 self . sub ( Level :: OnceHelp , msg, MultiSpan :: new ( ) ) ;
792802 self
793803 }
794804
795805 /// Add a help message attached to this diagnostic with a customizable highlighted message.
806+ #[ rustc_lint_diagnostics]
796807 pub fn highlighted_help ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
797808 self . sub_with_highlights ( Level :: Help , msg, MultiSpan :: new ( ) ) ;
798809 self
@@ -813,12 +824,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
813824 /// Disallow attaching suggestions this diagnostic.
814825 /// Any suggestions attached e.g. with the `span_suggestion_*` methods
815826 /// (before and after the call to `disable_suggestions`) will be ignored.
827+ #[ rustc_lint_diagnostics]
816828 pub fn disable_suggestions ( & mut self ) -> & mut Self {
817829 self . suggestions = Err ( SuggestionsDisabled ) ;
818830 self
819831 }
820832
821833 /// Helper for pushing to `self.suggestions`, if available (not disable).
834+ #[ rustc_lint_diagnostics]
822835 fn push_suggestion ( & mut self , suggestion : CodeSuggestion ) {
823836 for subst in & suggestion. substitutions {
824837 for part in & subst. parts {
@@ -839,6 +852,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
839852 with_fn ! { with_multipart_suggestion,
840853 /// Show a suggestion that has multiple parts to it.
841854 /// In other words, multiple changes need to be applied as part of this suggestion.
855+ #[ rustc_lint_diagnostics]
842856 pub fn multipart_suggestion(
843857 & mut self ,
844858 msg: impl Into <SubdiagnosticMessage >,
@@ -855,6 +869,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
855869
856870 /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
857871 /// In other words, multiple changes need to be applied as part of this suggestion.
872+ #[ rustc_lint_diagnostics]
858873 pub fn multipart_suggestion_verbose (
859874 & mut self ,
860875 msg : impl Into < SubdiagnosticMessage > ,
@@ -870,6 +885,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
870885 }
871886
872887 /// [`Diag::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
888+ #[ rustc_lint_diagnostics]
873889 pub fn multipart_suggestion_with_style (
874890 & mut self ,
875891 msg : impl Into < SubdiagnosticMessage > ,
@@ -912,6 +928,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
912928 /// be from the message, showing the span label inline would be visually unpleasant
913929 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
914930 /// improve understandability.
931+ #[ rustc_lint_diagnostics]
915932 pub fn tool_only_multipart_suggestion (
916933 & mut self ,
917934 msg : impl Into < SubdiagnosticMessage > ,
@@ -944,6 +961,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
944961 /// * may contain a name of a function, variable, or type, but not whole expressions
945962 ///
946963 /// See `CodeSuggestion` for more information.
964+ #[ rustc_lint_diagnostics]
947965 pub fn span_suggestion(
948966 & mut self ,
949967 sp: Span ,
@@ -962,6 +980,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
962980 } }
963981
964982 /// [`Diag::span_suggestion()`] but you can set the [`SuggestionStyle`].
983+ #[ rustc_lint_diagnostics]
965984 pub fn span_suggestion_with_style (
966985 & mut self ,
967986 sp : Span ,
@@ -987,6 +1006,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
9871006
9881007 with_fn ! { with_span_suggestion_verbose,
9891008 /// Always show the suggested change.
1009+ #[ rustc_lint_diagnostics]
9901010 pub fn span_suggestion_verbose(
9911011 & mut self ,
9921012 sp: Span ,
@@ -1007,6 +1027,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10071027 with_fn ! { with_span_suggestions,
10081028 /// Prints out a message with multiple suggested edits of the code.
10091029 /// See also [`Diag::span_suggestion()`].
1030+ #[ rustc_lint_diagnostics]
10101031 pub fn span_suggestions(
10111032 & mut self ,
10121033 sp: Span ,
@@ -1023,6 +1044,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10231044 )
10241045 } }
10251046
1047+ #[ rustc_lint_diagnostics]
10261048 pub fn span_suggestions_with_style (
10271049 & mut self ,
10281050 sp : Span ,
@@ -1053,6 +1075,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10531075 /// Prints out a message with multiple suggested edits of the code, where each edit consists of
10541076 /// multiple parts.
10551077 /// See also [`Diag::multipart_suggestion()`].
1078+ #[ rustc_lint_diagnostics]
10561079 pub fn multipart_suggestions (
10571080 & mut self ,
10581081 msg : impl Into < SubdiagnosticMessage > ,
@@ -1099,6 +1122,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10991122 /// inline, it will only show the message and not the suggestion.
11001123 ///
11011124 /// See `CodeSuggestion` for more information.
1125+ #[ rustc_lint_diagnostics]
11021126 pub fn span_suggestion_short(
11031127 & mut self ,
11041128 sp: Span ,
@@ -1122,6 +1146,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11221146 /// be from the message, showing the span label inline would be visually unpleasant
11231147 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
11241148 /// improve understandability.
1149+ #[ rustc_lint_diagnostics]
11251150 pub fn span_suggestion_hidden (
11261151 & mut self ,
11271152 sp : Span ,
@@ -1166,6 +1191,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11661191 /// [rustc_macros::Subdiagnostic]). Performs eager translation of any translatable messages
11671192 /// used in the subdiagnostic, so suitable for use with repeated messages (i.e. re-use of
11681193 /// interpolated variables).
1194+ #[ rustc_lint_diagnostics]
11691195 pub fn subdiagnostic (
11701196 & mut self ,
11711197 dcx : & crate :: DiagCtxt ,
@@ -1181,6 +1207,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11811207
11821208 with_fn ! { with_span,
11831209 /// Add a span.
1210+ #[ cfg_attr( not( bootstrap) , rustc_lint_diagnostics) ]
11841211 pub fn span( & mut self , sp: impl Into <MultiSpan >) -> & mut Self {
11851212 self . span = sp. into( ) ;
11861213 if let Some ( span) = self . span. primary_span( ) {
@@ -1189,27 +1216,31 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11891216 self
11901217 } }
11911218
1219+ #[ rustc_lint_diagnostics]
11921220 pub fn is_lint ( & mut self , name : String , has_future_breakage : bool ) -> & mut Self {
11931221 self . is_lint = Some ( IsLint { name, has_future_breakage } ) ;
11941222 self
11951223 }
11961224
11971225 with_fn ! { with_code,
11981226 /// Add an error code.
1227+ #[ rustc_lint_diagnostics]
11991228 pub fn code( & mut self , code: ErrCode ) -> & mut Self {
12001229 self . code = Some ( code) ;
12011230 self
12021231 } }
12031232
12041233 with_fn ! { with_primary_message,
12051234 /// Add a primary message.
1235+ #[ rustc_lint_diagnostics]
12061236 pub fn primary_message( & mut self , msg: impl Into <DiagnosticMessage >) -> & mut Self {
12071237 self . messages[ 0 ] = ( msg. into( ) , Style :: NoStyle ) ;
12081238 self
12091239 } }
12101240
12111241 with_fn ! { with_arg,
12121242 /// Add an argument.
1243+ #[ rustc_lint_diagnostics]
12131244 pub fn arg(
12141245 & mut self ,
12151246 name: impl Into <DiagArgName >,
0 commit comments