@@ -580,6 +580,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
580580 ///
581581 /// In the meantime, though, callsites are required to deal with the "bug"
582582 /// locally in whichever way makes the most sense.
583+ #[ rustc_lint_diagnostics]
583584 #[ track_caller]
584585 pub fn downgrade_to_delayed_bug ( & mut self ) {
585586 assert ! (
@@ -613,13 +614,15 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
613614 with_fn ! { with_span_labels,
614615 /// Labels all the given spans with the provided label.
615616 /// See [`Self::span_label()`] for more information.
617+ #[ rustc_lint_diagnostics]
616618 pub fn span_labels( & mut self , spans: impl IntoIterator <Item = Span >, label: & str ) -> & mut Self {
617619 for span in spans {
618620 self . span_label( span, label. to_string( ) ) ;
619621 }
620622 self
621623 } }
622624
625+ #[ rustc_lint_diagnostics]
623626 pub fn replace_span_with ( & mut self , after : Span , keep_label : bool ) -> & mut Self {
624627 let before = self . span . clone ( ) ;
625628 self . span ( after) ;
@@ -635,6 +638,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
635638 self
636639 }
637640
641+ #[ rustc_lint_diagnostics]
638642 pub fn note_expected_found (
639643 & mut self ,
640644 expected_label : & dyn fmt:: Display ,
@@ -645,6 +649,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
645649 self . note_expected_found_extra ( expected_label, expected, found_label, found, & "" , & "" )
646650 }
647651
652+ #[ rustc_lint_diagnostics]
648653 pub fn note_expected_found_extra (
649654 & mut self ,
650655 expected_label : & dyn fmt:: Display ,
@@ -687,6 +692,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
687692 self
688693 }
689694
695+ #[ rustc_lint_diagnostics]
690696 pub fn note_trait_signature ( & mut self , name : Symbol , signature : String ) -> & mut Self {
691697 self . highlighted_note ( vec ! [
692698 StringPart :: normal( format!( "`{name}` from trait: `" ) ) ,
@@ -704,12 +710,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
704710 self
705711 } }
706712
713+ #[ rustc_lint_diagnostics]
707714 fn highlighted_note ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
708715 self . sub_with_highlights ( Level :: Note , msg, MultiSpan :: new ( ) ) ;
709716 self
710717 }
711718
712719 /// This is like [`Diag::note()`], but it's only printed once.
720+ #[ rustc_lint_diagnostics]
713721 pub fn note_once ( & mut self , msg : impl Into < SubdiagnosticMessage > ) -> & mut Self {
714722 self . sub ( Level :: OnceNote , msg, MultiSpan :: new ( ) ) ;
715723 self
@@ -730,6 +738,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
730738
731739 /// Prints the span with a note above it.
732740 /// This is like [`Diag::note_once()`], but it gets its own span.
741+ #[ rustc_lint_diagnostics]
733742 pub fn span_note_once < S : Into < MultiSpan > > (
734743 & mut self ,
735744 sp : S ,
@@ -768,12 +777,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
768777 } }
769778
770779 /// This is like [`Diag::help()`], but it's only printed once.
780+ #[ rustc_lint_diagnostics]
771781 pub fn help_once ( & mut self , msg : impl Into < SubdiagnosticMessage > ) -> & mut Self {
772782 self . sub ( Level :: OnceHelp , msg, MultiSpan :: new ( ) ) ;
773783 self
774784 }
775785
776786 /// Add a help message attached to this diagnostic with a customizable highlighted message.
787+ #[ rustc_lint_diagnostics]
777788 pub fn highlighted_help ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
778789 self . sub_with_highlights ( Level :: Help , msg, MultiSpan :: new ( ) ) ;
779790 self
@@ -794,12 +805,14 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
794805 /// Disallow attaching suggestions this diagnostic.
795806 /// Any suggestions attached e.g. with the `span_suggestion_*` methods
796807 /// (before and after the call to `disable_suggestions`) will be ignored.
808+ #[ rustc_lint_diagnostics]
797809 pub fn disable_suggestions ( & mut self ) -> & mut Self {
798810 self . suggestions = Err ( SuggestionsDisabled ) ;
799811 self
800812 }
801813
802814 /// Helper for pushing to `self.suggestions`, if available (not disable).
815+ #[ rustc_lint_diagnostics]
803816 fn push_suggestion ( & mut self , suggestion : CodeSuggestion ) {
804817 for subst in & suggestion. substitutions {
805818 for part in & subst. parts {
@@ -820,6 +833,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
820833 with_fn ! { with_multipart_suggestion,
821834 /// Show a suggestion that has multiple parts to it.
822835 /// In other words, multiple changes need to be applied as part of this suggestion.
836+ #[ rustc_lint_diagnostics]
823837 pub fn multipart_suggestion(
824838 & mut self ,
825839 msg: impl Into <SubdiagnosticMessage >,
@@ -836,6 +850,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
836850
837851 /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
838852 /// In other words, multiple changes need to be applied as part of this suggestion.
853+ #[ rustc_lint_diagnostics]
839854 pub fn multipart_suggestion_verbose (
840855 & mut self ,
841856 msg : impl Into < SubdiagnosticMessage > ,
@@ -851,6 +866,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
851866 }
852867
853868 /// [`Diag::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
869+ #[ rustc_lint_diagnostics]
854870 pub fn multipart_suggestion_with_style (
855871 & mut self ,
856872 msg : impl Into < SubdiagnosticMessage > ,
@@ -893,6 +909,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
893909 /// be from the message, showing the span label inline would be visually unpleasant
894910 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
895911 /// improve understandability.
912+ #[ rustc_lint_diagnostics]
896913 pub fn tool_only_multipart_suggestion (
897914 & mut self ,
898915 msg : impl Into < SubdiagnosticMessage > ,
@@ -925,6 +942,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
925942 /// * may contain a name of a function, variable, or type, but not whole expressions
926943 ///
927944 /// See `CodeSuggestion` for more information.
945+ #[ rustc_lint_diagnostics]
928946 pub fn span_suggestion(
929947 & mut self ,
930948 sp: Span ,
@@ -943,6 +961,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
943961 } }
944962
945963 /// [`Diag::span_suggestion()`] but you can set the [`SuggestionStyle`].
964+ #[ rustc_lint_diagnostics]
946965 pub fn span_suggestion_with_style (
947966 & mut self ,
948967 sp : Span ,
@@ -968,6 +987,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
968987
969988 with_fn ! { with_span_suggestion_verbose,
970989 /// Always show the suggested change.
990+ #[ rustc_lint_diagnostics]
971991 pub fn span_suggestion_verbose(
972992 & mut self ,
973993 sp: Span ,
@@ -988,6 +1008,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
9881008 with_fn ! { with_span_suggestions,
9891009 /// Prints out a message with multiple suggested edits of the code.
9901010 /// See also [`Diag::span_suggestion()`].
1011+ #[ rustc_lint_diagnostics]
9911012 pub fn span_suggestions(
9921013 & mut self ,
9931014 sp: Span ,
@@ -1004,6 +1025,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10041025 )
10051026 } }
10061027
1028+ #[ rustc_lint_diagnostics]
10071029 pub fn span_suggestions_with_style (
10081030 & mut self ,
10091031 sp : Span ,
@@ -1034,6 +1056,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10341056 /// Prints out a message with multiple suggested edits of the code, where each edit consists of
10351057 /// multiple parts.
10361058 /// See also [`Diag::multipart_suggestion()`].
1059+ #[ rustc_lint_diagnostics]
10371060 pub fn multipart_suggestions (
10381061 & mut self ,
10391062 msg : impl Into < SubdiagnosticMessage > ,
@@ -1080,6 +1103,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
10801103 /// inline, it will only show the message and not the suggestion.
10811104 ///
10821105 /// See `CodeSuggestion` for more information.
1106+ #[ rustc_lint_diagnostics]
10831107 pub fn span_suggestion_short(
10841108 & mut self ,
10851109 sp: Span ,
@@ -1103,6 +1127,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11031127 /// be from the message, showing the span label inline would be visually unpleasant
11041128 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
11051129 /// improve understandability.
1130+ #[ rustc_lint_diagnostics]
11061131 pub fn span_suggestion_hidden (
11071132 & mut self ,
11081133 sp : Span ,
@@ -1147,6 +1172,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11471172 /// [rustc_macros::Subdiagnostic]). Performs eager translation of any translatable messages
11481173 /// used in the subdiagnostic, so suitable for use with repeated messages (i.e. re-use of
11491174 /// interpolated variables).
1175+ #[ rustc_lint_diagnostics]
11501176 pub fn subdiagnostic (
11511177 & mut self ,
11521178 dcx : & crate :: DiagCtxt ,
@@ -1162,6 +1188,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11621188
11631189 with_fn ! { with_span,
11641190 /// Add a span.
1191+ #[ cfg_attr( not( bootstrap) , rustc_lint_diagnostics) ]
11651192 pub fn span( & mut self , sp: impl Into <MultiSpan >) -> & mut Self {
11661193 self . span = sp. into( ) ;
11671194 if let Some ( span) = self . span. primary_span( ) {
@@ -1170,27 +1197,31 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
11701197 self
11711198 } }
11721199
1200+ #[ rustc_lint_diagnostics]
11731201 pub fn is_lint ( & mut self , name : String , has_future_breakage : bool ) -> & mut Self {
11741202 self . is_lint = Some ( IsLint { name, has_future_breakage } ) ;
11751203 self
11761204 }
11771205
11781206 with_fn ! { with_code,
11791207 /// Add an error code.
1208+ #[ rustc_lint_diagnostics]
11801209 pub fn code( & mut self , code: ErrCode ) -> & mut Self {
11811210 self . code = Some ( code) ;
11821211 self
11831212 } }
11841213
11851214 with_fn ! { with_primary_message,
11861215 /// Add a primary message.
1216+ #[ rustc_lint_diagnostics]
11871217 pub fn primary_message( & mut self , msg: impl Into <DiagnosticMessage >) -> & mut Self {
11881218 self . messages[ 0 ] = ( msg. into( ) , Style :: NoStyle ) ;
11891219 self
11901220 } }
11911221
11921222 with_fn ! { with_arg,
11931223 /// Add an argument.
1224+ #[ rustc_lint_diagnostics]
11941225 pub fn arg(
11951226 & mut self ,
11961227 name: impl Into <DiagArgName >,
0 commit comments