@@ -586,6 +586,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
586586 ///
587587 /// In the meantime, though, callsites are required to deal with the "bug"
588588 /// locally in whichever way makes the most sense.
589+ #[ rustc_lint_diagnostics]
589590 #[ track_caller]
590591 pub fn downgrade_to_delayed_bug ( & mut self ) {
591592 assert ! (
@@ -619,13 +620,15 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
619620 with_fn ! { with_span_labels,
620621 /// Labels all the given spans with the provided label.
621622 /// See [`Self::span_label()`] for more information.
623+ #[ rustc_lint_diagnostics]
622624 pub fn span_labels( & mut self , spans: impl IntoIterator <Item = Span >, label: & str ) -> & mut Self {
623625 for span in spans {
624626 self . span_label( span, label. to_string( ) ) ;
625627 }
626628 self
627629 } }
628630
631+ #[ rustc_lint_diagnostics]
629632 pub fn replace_span_with ( & mut self , after : Span , keep_label : bool ) -> & mut Self {
630633 let before = self . span . clone ( ) ;
631634 self . span ( after) ;
@@ -641,6 +644,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
641644 self
642645 }
643646
647+ #[ rustc_lint_diagnostics]
644648 pub fn note_expected_found (
645649 & mut self ,
646650 expected_label : & dyn fmt:: Display ,
@@ -651,6 +655,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
651655 self . note_expected_found_extra ( expected_label, expected, found_label, found, & "" , & "" )
652656 }
653657
658+ #[ rustc_lint_diagnostics]
654659 pub fn note_expected_found_extra (
655660 & mut self ,
656661 expected_label : & dyn fmt:: Display ,
@@ -693,6 +698,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
693698 self
694699 }
695700
701+ #[ rustc_lint_diagnostics]
696702 pub fn note_trait_signature ( & mut self , name : Symbol , signature : String ) -> & mut Self {
697703 self . highlighted_note ( vec ! [
698704 StringPart :: normal( format!( "`{name}` from trait: `" ) ) ,
@@ -710,12 +716,14 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
710716 self
711717 } }
712718
719+ #[ rustc_lint_diagnostics]
713720 fn highlighted_note ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
714721 self . sub_with_highlights ( Level :: Note , msg, MultiSpan :: new ( ) ) ;
715722 self
716723 }
717724
718725 /// This is like [`DiagnosticBuilder::note()`], but it's only printed once.
726+ #[ rustc_lint_diagnostics]
719727 pub fn note_once ( & mut self , msg : impl Into < SubdiagnosticMessage > ) -> & mut Self {
720728 self . sub ( Level :: OnceNote , msg, MultiSpan :: new ( ) ) ;
721729 self
@@ -736,6 +744,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
736744
737745 /// Prints the span with a note above it.
738746 /// This is like [`DiagnosticBuilder::note_once()`], but it gets its own span.
747+ #[ rustc_lint_diagnostics]
739748 pub fn span_note_once < S : Into < MultiSpan > > (
740749 & mut self ,
741750 sp : S ,
@@ -774,12 +783,14 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
774783 } }
775784
776785 /// This is like [`DiagnosticBuilder::help()`], but it's only printed once.
786+ #[ rustc_lint_diagnostics]
777787 pub fn help_once ( & mut self , msg : impl Into < SubdiagnosticMessage > ) -> & mut Self {
778788 self . sub ( Level :: OnceHelp , msg, MultiSpan :: new ( ) ) ;
779789 self
780790 }
781791
782792 /// Add a help message attached to this diagnostic with a customizable highlighted message.
793+ #[ rustc_lint_diagnostics]
783794 pub fn highlighted_help ( & mut self , msg : Vec < StringPart > ) -> & mut Self {
784795 self . sub_with_highlights ( Level :: Help , msg, MultiSpan :: new ( ) ) ;
785796 self
@@ -800,12 +811,14 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
800811 /// Disallow attaching suggestions this diagnostic.
801812 /// Any suggestions attached e.g. with the `span_suggestion_*` methods
802813 /// (before and after the call to `disable_suggestions`) will be ignored.
814+ #[ rustc_lint_diagnostics]
803815 pub fn disable_suggestions ( & mut self ) -> & mut Self {
804816 self . suggestions = Err ( SuggestionsDisabled ) ;
805817 self
806818 }
807819
808820 /// Helper for pushing to `self.suggestions`, if available (not disable).
821+ #[ rustc_lint_diagnostics]
809822 fn push_suggestion ( & mut self , suggestion : CodeSuggestion ) {
810823 for subst in & suggestion. substitutions {
811824 for part in & subst. parts {
@@ -826,6 +839,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
826839 with_fn ! { with_multipart_suggestion,
827840 /// Show a suggestion that has multiple parts to it.
828841 /// In other words, multiple changes need to be applied as part of this suggestion.
842+ #[ rustc_lint_diagnostics]
829843 pub fn multipart_suggestion(
830844 & mut self ,
831845 msg: impl Into <SubdiagnosticMessage >,
@@ -842,6 +856,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
842856
843857 /// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
844858 /// In other words, multiple changes need to be applied as part of this suggestion.
859+ #[ rustc_lint_diagnostics]
845860 pub fn multipart_suggestion_verbose (
846861 & mut self ,
847862 msg : impl Into < SubdiagnosticMessage > ,
@@ -857,6 +872,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
857872 }
858873
859874 /// [`DiagnosticBuilder::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
875+ #[ rustc_lint_diagnostics]
860876 pub fn multipart_suggestion_with_style (
861877 & mut self ,
862878 msg : impl Into < SubdiagnosticMessage > ,
@@ -899,6 +915,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
899915 /// be from the message, showing the span label inline would be visually unpleasant
900916 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
901917 /// improve understandability.
918+ #[ rustc_lint_diagnostics]
902919 pub fn tool_only_multipart_suggestion (
903920 & mut self ,
904921 msg : impl Into < SubdiagnosticMessage > ,
@@ -931,6 +948,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
931948 /// * may contain a name of a function, variable, or type, but not whole expressions
932949 ///
933950 /// See `CodeSuggestion` for more information.
951+ #[ rustc_lint_diagnostics]
934952 pub fn span_suggestion(
935953 & mut self ,
936954 sp: Span ,
@@ -949,6 +967,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
949967 } }
950968
951969 /// [`DiagnosticBuilder::span_suggestion()`] but you can set the [`SuggestionStyle`].
970+ #[ rustc_lint_diagnostics]
952971 pub fn span_suggestion_with_style (
953972 & mut self ,
954973 sp : Span ,
@@ -974,6 +993,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
974993
975994 with_fn ! { with_span_suggestion_verbose,
976995 /// Always show the suggested change.
996+ #[ rustc_lint_diagnostics]
977997 pub fn span_suggestion_verbose(
978998 & mut self ,
979999 sp: Span ,
@@ -994,6 +1014,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
9941014 with_fn ! { with_span_suggestions,
9951015 /// Prints out a message with multiple suggested edits of the code.
9961016 /// See also [`DiagnosticBuilder::span_suggestion()`].
1017+ #[ rustc_lint_diagnostics]
9971018 pub fn span_suggestions(
9981019 & mut self ,
9991020 sp: Span ,
@@ -1010,6 +1031,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
10101031 )
10111032 } }
10121033
1034+ #[ rustc_lint_diagnostics]
10131035 pub fn span_suggestions_with_style (
10141036 & mut self ,
10151037 sp : Span ,
@@ -1040,6 +1062,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
10401062 /// Prints out a message with multiple suggested edits of the code, where each edit consists of
10411063 /// multiple parts.
10421064 /// See also [`DiagnosticBuilder::multipart_suggestion()`].
1065+ #[ rustc_lint_diagnostics]
10431066 pub fn multipart_suggestions (
10441067 & mut self ,
10451068 msg : impl Into < SubdiagnosticMessage > ,
@@ -1086,6 +1109,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
10861109 /// inline, it will only show the message and not the suggestion.
10871110 ///
10881111 /// See `CodeSuggestion` for more information.
1112+ #[ rustc_lint_diagnostics]
10891113 pub fn span_suggestion_short(
10901114 & mut self ,
10911115 sp: Span ,
@@ -1109,6 +1133,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
11091133 /// be from the message, showing the span label inline would be visually unpleasant
11101134 /// (marginally overlapping spans or multiline spans) and showing the snippet window wouldn't
11111135 /// improve understandability.
1136+ #[ rustc_lint_diagnostics]
11121137 pub fn span_suggestion_hidden (
11131138 & mut self ,
11141139 sp : Span ,
@@ -1153,6 +1178,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
11531178 /// [rustc_macros::Subdiagnostic]). Performs eager translation of any translatable messages
11541179 /// used in the subdiagnostic, so suitable for use with repeated messages (i.e. re-use of
11551180 /// interpolated variables).
1181+ #[ rustc_lint_diagnostics]
11561182 pub fn subdiagnostic (
11571183 & mut self ,
11581184 dcx : & crate :: DiagCtxt ,
@@ -1168,6 +1194,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
11681194
11691195 with_fn ! { with_span,
11701196 /// Add a span.
1197+ #[ rustc_lint_diagnostics]
11711198 pub fn span( & mut self , sp: impl Into <MultiSpan >) -> & mut Self {
11721199 self . span = sp. into( ) ;
11731200 if let Some ( span) = self . span. primary_span( ) {
@@ -1176,27 +1203,31 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
11761203 self
11771204 } }
11781205
1206+ #[ rustc_lint_diagnostics]
11791207 pub fn is_lint ( & mut self , name : String , has_future_breakage : bool ) -> & mut Self {
11801208 self . is_lint = Some ( IsLint { name, has_future_breakage } ) ;
11811209 self
11821210 }
11831211
11841212 with_fn ! { with_code,
11851213 /// Add an error code.
1214+ #[ rustc_lint_diagnostics]
11861215 pub fn code( & mut self , code: ErrCode ) -> & mut Self {
11871216 self . code = Some ( code) ;
11881217 self
11891218 } }
11901219
11911220 with_fn ! { with_primary_message,
11921221 /// Add a primary message.
1222+ #[ rustc_lint_diagnostics]
11931223 pub fn primary_message( & mut self , msg: impl Into <DiagnosticMessage >) -> & mut Self {
11941224 self . messages[ 0 ] = ( msg. into( ) , Style :: NoStyle ) ;
11951225 self
11961226 } }
11971227
11981228 with_fn ! { with_arg,
11991229 /// Add an argument.
1230+ #[ rustc_lint_diagnostics]
12001231 pub fn arg(
12011232 & mut self ,
12021233 name: impl Into <DiagnosticArgName >,
0 commit comments