about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast_lowering/src/errors.rs4
-rw-r--r--compiler/rustc_ast_passes/src/errors.rs2
-rw-r--r--compiler/rustc_attr/src/session_diagnostics.rs4
-rw-r--r--compiler/rustc_borrowck/src/session_diagnostics.rs12
-rw-r--r--compiler/rustc_error_messages/src/lib.rs4
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs9
-rw-r--r--compiler/rustc_expand/src/mbe/macro_rules.rs2
-rw-r--r--compiler/rustc_lint/src/errors.rs4
-rw-r--r--compiler/rustc_lint/src/internal.rs2
-rw-r--r--compiler/rustc_macros/src/diagnostics/mod.rs10
-rw-r--r--compiler/rustc_macros/src/diagnostics/subdiagnostic.rs18
-rw-r--r--compiler/rustc_macros/src/lib.rs2
-rw-r--r--compiler/rustc_middle/src/error.rs2
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs14
-rw-r--r--compiler/rustc_passes/src/errors.rs4
-rw-r--r--compiler/rustc_privacy/src/errors.rs4
-rw-r--r--compiler/rustc_query_system/src/error.rs7
-rw-r--r--compiler/rustc_session/src/errors.rs4
-rw-r--r--compiler/rustc_span/src/symbol.rs2
-rw-r--r--compiler/rustc_ty_utils/src/errors.rs4
-rw-r--r--compiler/rustc_typeck/src/errors.rs6
21 files changed, 61 insertions, 59 deletions
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs
index 6dbb2582a37..052979d6d45 100644
--- a/compiler/rustc_ast_lowering/src/errors.rs
+++ b/compiler/rustc_ast_lowering/src/errors.rs
@@ -1,5 +1,5 @@
 use rustc_errors::{fluent, AddToDiagnostic, Applicability, Diagnostic, DiagnosticArgFromDisplay};
-use rustc_macros::{Diagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::{symbol::Ident, Span, Symbol};
 
 #[derive(Diagnostic, Clone, Copy)]
@@ -221,7 +221,7 @@ pub struct InvalidAsmTemplateModifierRegClass {
     pub sub: InvalidAsmTemplateModifierRegClassSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum InvalidAsmTemplateModifierRegClassSub {
     #[note(ast_lowering::support_modifiers)]
     SupportModifier { class_name: Symbol, modifiers: String },
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs
index 20e2209acbe..035f0ce1cbc 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/errors.rs
@@ -71,7 +71,7 @@ pub struct InvalidVisibility {
     pub note: Option<InvalidVisibilityNote>,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum InvalidVisibilityNote {
     #[note(ast_passes::individual_impl_items)]
     IndividualImplItems,
diff --git a/compiler/rustc_attr/src/session_diagnostics.rs b/compiler/rustc_attr/src/session_diagnostics.rs
index 5e8f9b79850..940a48ed915 100644
--- a/compiler/rustc_attr/src/session_diagnostics.rs
+++ b/compiler/rustc_attr/src/session_diagnostics.rs
@@ -98,7 +98,7 @@ pub(crate) struct InvalidIssueString {
 
 // The error kinds of `IntErrorKind` are duplicated here in order to allow the messages to be
 // translatable.
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum InvalidIssueStringCause {
     #[label(attr::must_not_be_zero)]
     MustNotBeZero {
@@ -274,7 +274,7 @@ pub(crate) struct IncorrectReprFormatGeneric<'a> {
     pub cause: Option<IncorrectReprFormatGenericCause<'a>>,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum IncorrectReprFormatGenericCause<'a> {
     #[suggestion(attr::suggestion, code = "{name}({int})", applicability = "machine-applicable")]
     Int {
diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs
index aa8f26eece5..9f19453a1a6 100644
--- a/compiler/rustc_borrowck/src/session_diagnostics.rs
+++ b/compiler/rustc_borrowck/src/session_diagnostics.rs
@@ -1,5 +1,5 @@
 use rustc_errors::{IntoDiagnosticArg, MultiSpan};
-use rustc_macros::{Diagnostic, LintDiagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
 use rustc_middle::ty::Ty;
 use rustc_span::Span;
 
@@ -23,7 +23,7 @@ pub(crate) struct HigherRankedLifetimeError {
     pub span: Span,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum HigherRankedErrorCause {
     #[note(borrowck::could_not_prove)]
     CouldNotProve { predicate: String },
@@ -72,7 +72,7 @@ pub(crate) struct FnMutError {
     pub ty_err: FnMutReturnTypeErr,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum VarHereDenote {
     #[label(borrowck::var_here_captured)]
     Captured {
@@ -91,7 +91,7 @@ pub(crate) enum VarHereDenote {
     },
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum FnMutReturnTypeErr {
     #[label(borrowck::returned_closure_escaped)]
     ReturnClosure {
@@ -117,7 +117,7 @@ pub(crate) struct LifetimeOutliveErr {
     pub span: Span,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum LifetimeReturnCategoryErr<'a> {
     #[label(borrowck::returned_lifetime_wrong)]
     WrongReturn {
@@ -149,7 +149,7 @@ impl IntoDiagnosticArg for RegionName {
     }
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum RequireStaticErr {
     #[note(borrowck::used_impl_require_static)]
     UsedImpl {
diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs
index b6e0f3faa73..ff33ae7e8f2 100644
--- a/compiler/rustc_error_messages/src/lib.rs
+++ b/compiler/rustc_error_messages/src/lib.rs
@@ -268,14 +268,14 @@ type FluentId = Cow<'static, str>;
 /// Translatable messages for subdiagnostics are typically attributes attached to a larger Fluent
 /// message so messages of this type must be combined with a `DiagnosticMessage` (using
 /// `DiagnosticMessage::with_subdiagnostic_message`) before rendering. However, subdiagnostics from
-/// the `SessionSubdiagnostic` derive refer to Fluent identifiers directly.
+/// the `Subdiagnostic` derive refer to Fluent identifiers directly.
 #[rustc_diagnostic_item = "SubdiagnosticMessage"]
 pub enum SubdiagnosticMessage {
     /// Non-translatable diagnostic message.
     // FIXME(davidtwco): can a `Cow<'static, str>` be used here?
     Str(String),
     /// Identifier of a Fluent message. Instances of this variant are generated by the
-    /// `SessionSubdiagnostic` derive.
+    /// `Subdiagnostic` derive.
     FluentIdentifier(FluentId),
     /// Attribute of a Fluent message. Needs to be combined with a Fluent identifier to produce an
     /// actual translated message. Instances of this variant are generated by the `fluent_messages`
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index d3a263ac56d..c66889189ad 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -176,8 +176,9 @@ impl IntoDiagnosticArg for hir::ConstContext {
 }
 
 /// Trait implemented by error types. This should not be implemented manually. Instead, use
-/// `#[derive(SessionSubdiagnostic)]` -- see [rustc_macros::SessionSubdiagnostic].
-#[rustc_diagnostic_item = "AddSubdiagnostic"]
+/// `#[derive(Subdiagnostic)]` -- see [rustc_macros::Subdiagnostic].
+#[cfg_attr(bootstrap, rustc_diagnostic_item = "AddSubdiagnostic")]
+#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "Subdiagnostic")]
 pub trait AddToDiagnostic {
     /// Add a subdiagnostic to an existing diagnostic.
     fn add_to_diagnostic(self, diag: &mut Diagnostic);
@@ -891,8 +892,8 @@ impl Diagnostic {
         self
     }
 
-    /// Add a subdiagnostic from a type that implements `SessionSubdiagnostic` - see
-    /// [rustc_macros::SessionSubdiagnostic].
+    /// Add a subdiagnostic from a type that implements `Subdiagnostic` - see
+    /// [rustc_macros::Subdiagnostic].
     pub fn subdiagnostic(&mut self, subdiagnostic: impl AddToDiagnostic) -> &mut Self {
         subdiagnostic.add_to_diagnostic(self);
         self
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs
index 7764ffd246e..6d2c7aac6af 100644
--- a/compiler/rustc_expand/src/mbe/macro_rules.rs
+++ b/compiler/rustc_expand/src/mbe/macro_rules.rs
@@ -593,7 +593,7 @@ pub fn compile_declarative_macro(
     (mk_syn_ext(expander), rule_spans)
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 enum ExplainDocComment {
     #[label(expand::explain_doc_comment_inner)]
     Inner {
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs
index 0c66ce475c4..3a89d90c88a 100644
--- a/compiler/rustc_lint/src/errors.rs
+++ b/compiler/rustc_lint/src/errors.rs
@@ -1,5 +1,5 @@
 use rustc_errors::{fluent, AddToDiagnostic, IntoDiagnostic, ErrorGuaranteed, Handler};
-use rustc_macros::{Diagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_session::lint::Level;
 use rustc_span::{Span, Symbol};
 
@@ -51,7 +51,7 @@ pub struct MalformedAttribute {
     pub sub: MalformedAttributeSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum MalformedAttributeSub {
     #[label(lint::bad_attribute_argument)]
     BadAttributeArgument(#[primary_span] Span),
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index 36d8ade22ae..942475d31fe 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -404,7 +404,7 @@ impl LateLintPass<'_> for Diagnostics {
                 let Impl { of_trait: Some(of_trait), .. } = impl_ &&
                 let Some(def_id) = of_trait.trait_def_id() &&
                 let Some(name) = cx.tcx.get_diagnostic_name(def_id) &&
-                matches!(name, sym::Diagnostic | sym::AddSubdiagnostic | sym::DecorateLint)
+                matches!(name, sym::Diagnostic | sym::Subdiagnostic | sym::DecorateLint)
             {
                 found_impl = true;
                 break;
diff --git a/compiler/rustc_macros/src/diagnostics/mod.rs b/compiler/rustc_macros/src/diagnostics/mod.rs
index 1d5b32c2556..8eaa8b87c0f 100644
--- a/compiler/rustc_macros/src/diagnostics/mod.rs
+++ b/compiler/rustc_macros/src/diagnostics/mod.rs
@@ -9,7 +9,7 @@ use diagnostic::{LintDiagnosticDerive, SessionDiagnosticDerive};
 pub(crate) use fluent::fluent_messages;
 use proc_macro2::TokenStream;
 use quote::format_ident;
-use subdiagnostic::SessionSubdiagnosticDerive;
+use subdiagnostic::SubdiagnosticDerive;
 use synstructure::Structure;
 
 /// Implements `#[derive(Diagnostic)]`, which allows for errors to be specified as a struct,
@@ -108,12 +108,12 @@ pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
     LintDiagnosticDerive::new(format_ident!("diag"), s).into_tokens()
 }
 
-/// Implements `#[derive(SessionSubdiagnostic)]`, which allows for labels, notes, helps and
+/// Implements `#[derive(Subdiagnostic)]`, which allows for labels, notes, helps and
 /// suggestions to be specified as a structs or enums, independent from the actual diagnostics
 /// emitting code or diagnostic derives.
 ///
 /// ```ignore (rust)
-/// #[derive(SessionSubdiagnostic)]
+/// #[derive(Subdiagnostic)]
 /// pub enum ExpectedIdentifierLabel<'tcx> {
 ///     #[label(parser::expected_identifier)]
 ///     WithoutFound {
@@ -128,7 +128,7 @@ pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
 ///     }
 /// }
 ///
-/// #[derive(SessionSubdiagnostic)]
+/// #[derive(Subdiagnostic)]
 /// #[suggestion_verbose(parser::raw_identifier)]
 /// pub struct RawIdentifierSuggestion<'tcx> {
 ///     #[primary_span]
@@ -155,5 +155,5 @@ pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
 /// diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident });
 /// ```
 pub fn session_subdiagnostic_derive(s: Structure<'_>) -> TokenStream {
-    SessionSubdiagnosticDerive::new(s).into_tokens()
+    SubdiagnosticDerive::new(s).into_tokens()
 }
diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
index f1bb7feb062..bdeca3420bc 100644
--- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
+++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs
@@ -98,19 +98,19 @@ impl quote::IdentFragment for SubdiagnosticKind {
 }
 
 /// The central struct for constructing the `add_to_diagnostic` method from an annotated struct.
-pub(crate) struct SessionSubdiagnosticDerive<'a> {
+pub(crate) struct SubdiagnosticDerive<'a> {
     structure: Structure<'a>,
     diag: syn::Ident,
 }
 
-impl<'a> SessionSubdiagnosticDerive<'a> {
+impl<'a> SubdiagnosticDerive<'a> {
     pub(crate) fn new(structure: Structure<'a>) -> Self {
         let diag = format_ident!("diag");
         Self { structure, diag }
     }
 
     pub(crate) fn into_tokens(self) -> TokenStream {
-        let SessionSubdiagnosticDerive { mut structure, diag } = self;
+        let SubdiagnosticDerive { mut structure, diag } = self;
         let implementation = {
             let ast = structure.ast();
             let span = ast.span().unwrap();
@@ -119,7 +119,7 @@ impl<'a> SessionSubdiagnosticDerive<'a> {
                 syn::Data::Union(..) => {
                     span_err(
                         span,
-                        "`#[derive(SessionSubdiagnostic)]` can only be used on structs and enums",
+                        "`#[derive(Subdiagnostic)]` can only be used on structs and enums",
                     );
                 }
             }
@@ -146,7 +146,7 @@ impl<'a> SessionSubdiagnosticDerive<'a> {
                     }
                 }
 
-                let mut builder = SessionSubdiagnosticDeriveBuilder {
+                let mut builder = SubdiagnosticDeriveBuilder {
                     diag: &diag,
                     variant,
                     span,
@@ -178,10 +178,10 @@ impl<'a> SessionSubdiagnosticDerive<'a> {
 }
 
 /// Tracks persistent information required for building up the call to add to the diagnostic
-/// for the final generated method. This is a separate struct to `SessionSubdiagnosticDerive`
+/// for the final generated method. This is a separate struct to `SubdiagnosticDerive`
 /// only to be able to destructure and split `self.builder` and the `self.structure` up to avoid a
 /// double mut borrow later on.
-struct SessionSubdiagnosticDeriveBuilder<'a> {
+struct SubdiagnosticDeriveBuilder<'a> {
     /// The identifier to use for the generated `DiagnosticBuilder` instance.
     diag: &'a syn::Ident,
 
@@ -205,7 +205,7 @@ struct SessionSubdiagnosticDeriveBuilder<'a> {
     has_suggestion_parts: bool,
 }
 
-impl<'a> HasFieldMap for SessionSubdiagnosticDeriveBuilder<'a> {
+impl<'a> HasFieldMap for SubdiagnosticDeriveBuilder<'a> {
     fn get_field_binding(&self, field: &String) -> Option<&TokenStream> {
         self.fields.get(field)
     }
@@ -241,7 +241,7 @@ impl<'a> FromIterator<&'a SubdiagnosticKind> for KindsStatistics {
     }
 }
 
-impl<'a> SessionSubdiagnosticDeriveBuilder<'a> {
+impl<'a> SubdiagnosticDeriveBuilder<'a> {
     fn identify_kind(&mut self) -> Result<Vec<(SubdiagnosticKind, Path)>, DiagnosticDeriveError> {
         let mut kind_slugs = vec![];
 
diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs
index 9dd7ccad8bb..8fd23ee5ced 100644
--- a/compiler/rustc_macros/src/lib.rs
+++ b/compiler/rustc_macros/src/lib.rs
@@ -161,7 +161,7 @@ decl_derive!(
         suggestion_verbose)] => diagnostics::lint_diagnostic_derive
 );
 decl_derive!(
-    [SessionSubdiagnostic, attributes(
+    [Subdiagnostic, attributes(
         // struct/variant attributes
         label,
         help,
diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs
index 6d15feb888a..a4ceb494569 100644
--- a/compiler/rustc_middle/src/error.rs
+++ b/compiler/rustc_middle/src/error.rs
@@ -25,7 +25,7 @@ pub struct OpaqueHiddenTypeMismatch<'tcx> {
     pub sub: TypeMismatchReason,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum TypeMismatchReason {
     #[label(middle::conflict_types)]
     ConflictType {
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 9989ebb7cdf..78bc29fc375 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -20,7 +20,7 @@ use rustc_errors::{
     fluent, Applicability, DiagnosticBuilder, DiagnosticMessage, Handler, MultiSpan, PResult,
 };
 use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorGuaranteed};
-use rustc_macros::{Diagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_span::source_map::Spanned;
 use rustc_span::symbol::{kw, sym, Ident};
 use rustc_span::{Span, SpanSnippetError, DUMMY_SP};
@@ -261,7 +261,7 @@ struct BadTypePlus {
     pub sub: BadTypePlusSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum BadTypePlusSub {
     #[suggestion(
         parser::add_paren,
@@ -342,7 +342,7 @@ pub struct InvalidVariableDeclaration {
     pub sub: InvalidVariableDeclarationSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum InvalidVariableDeclarationSub {
     #[suggestion(
         parser::switch_mut_let_order,
@@ -372,7 +372,7 @@ pub(crate) struct InvalidComparisonOperator {
     pub sub: InvalidComparisonOperatorSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum InvalidComparisonOperatorSub {
     #[suggestion_short(
         parser::use_instead,
@@ -400,7 +400,7 @@ pub(crate) struct InvalidLogicalOperator {
     pub sub: InvalidLogicalOperatorSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum InvalidLogicalOperatorSub {
     #[suggestion_short(
         parser::use_amp_amp_for_conjunction,
@@ -605,7 +605,7 @@ pub(crate) struct IfExpressionMissingThenBlock {
     pub sub: IfExpressionMissingThenBlockSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum IfExpressionMissingThenBlockSub {
     #[help(parser::condition_possibly_unfinished)]
     UnfinishedCondition(#[primary_span] Span),
@@ -668,7 +668,7 @@ pub(crate) struct MissingInInForLoop {
     pub sub: MissingInInForLoopSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub(crate) enum MissingInInForLoopSub {
     // Has been misleading, at least in the past (closed Issue #48492), thus maybe-incorrect
     #[suggestion_short(parser::use_in_not_of, applicability = "maybe-incorrect", code = "in")]
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs
index bff2978bd13..52aea9bba43 100644
--- a/compiler/rustc_passes/src/errors.rs
+++ b/compiler/rustc_passes/src/errors.rs
@@ -1,5 +1,5 @@
 use rustc_errors::{Applicability, MultiSpan};
-use rustc_macros::{Diagnostic, LintDiagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
 use rustc_span::{Span, Symbol};
 
 #[derive(LintDiagnostic)]
@@ -583,7 +583,7 @@ pub struct MacroExport;
 #[diag(passes::plugin_registrar)]
 pub struct PluginRegistrar;
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum UnusedNote {
     #[note(passes::unused_empty_lints_note)]
     EmptyList { name: Symbol },
diff --git a/compiler/rustc_privacy/src/errors.rs b/compiler/rustc_privacy/src/errors.rs
index 71552119482..f3a617c2f0f 100644
--- a/compiler/rustc_privacy/src/errors.rs
+++ b/compiler/rustc_privacy/src/errors.rs
@@ -1,5 +1,5 @@
 use rustc_errors::DiagnosticArgFromDisplay;
-use rustc_macros::{Diagnostic, LintDiagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
 use rustc_span::{Span, Symbol};
 
 #[derive(Diagnostic)]
@@ -14,7 +14,7 @@ pub struct FieldIsPrivate {
     pub label: FieldIsPrivateLabel,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum FieldIsPrivateLabel {
     #[label(privacy::field_is_private_is_update_syntax_label)]
     IsUpdateSyntax {
diff --git a/compiler/rustc_query_system/src/error.rs b/compiler/rustc_query_system/src/error.rs
index 4c770152f12..ceec75fce28 100644
--- a/compiler/rustc_query_system/src/error.rs
+++ b/compiler/rustc_query_system/src/error.rs
@@ -1,6 +1,7 @@
 use rustc_errors::AddToDiagnostic;
 use rustc_session::Limit;
 use rustc_span::{Span, Symbol};
+use rustc_macros::{Diagnostic, Subdiagnostic};
 
 pub struct CycleStack {
     pub span: Span,
@@ -20,7 +21,7 @@ pub enum HandleCycleError {
     DelayBug,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum StackCount {
     #[note(query_system::cycle_stack_single)]
     Single,
@@ -28,7 +29,7 @@ pub enum StackCount {
     Multiple,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum Alias {
     #[note(query_system::cycle_recursive_ty_alias)]
     #[help(query_system::cycle_recursive_ty_alias_help1)]
@@ -38,7 +39,7 @@ pub enum Alias {
     Trait,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 #[note(query_system::cycle_usage)]
 pub struct CycleUsage {
     #[primary_span]
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs
index 7ffe757463f..997a45272bc 100644
--- a/compiler/rustc_session/src/errors.rs
+++ b/compiler/rustc_session/src/errors.rs
@@ -34,13 +34,13 @@ pub struct FeatureGateError<'a> {
     pub explain: &'a str,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 #[note(session::feature_diagnostic_for_issue)]
 pub struct FeatureDiagnosticForIssue {
     pub n: NonZeroU32,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 #[help(session::feature_diagnostic_help)]
 pub struct FeatureDiagnosticHelp {
     pub feature: Symbol,
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index ea69334616b..1baad6a9fd7 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -125,7 +125,6 @@ symbols! {
     Symbols {
         AcqRel,
         Acquire,
-        AddSubdiagnostic,
         Alignment,
         Any,
         Arc,
@@ -283,6 +282,7 @@ symbols! {
         String,
         StructuralEq,
         StructuralPartialEq,
+        Subdiagnostic,
         SubdiagnosticMessage,
         Sync,
         T,
diff --git a/compiler/rustc_ty_utils/src/errors.rs b/compiler/rustc_ty_utils/src/errors.rs
index 85165187310..753c474a34b 100644
--- a/compiler/rustc_ty_utils/src/errors.rs
+++ b/compiler/rustc_ty_utils/src/errors.rs
@@ -1,6 +1,6 @@
 //! Errors emitted by ty_utils
 
-use rustc_macros::{Diagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, Subdiagnostic};
 use rustc_middle::ty::Ty;
 use rustc_span::Span;
 
@@ -22,7 +22,7 @@ pub struct GenericConstantTooComplex {
     pub sub: GenericConstantTooComplexSub,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum GenericConstantTooComplexSub {
     #[label(ty_utils::borrow_not_supported)]
     BorrowNotSupported(#[primary_span] Span),
diff --git a/compiler/rustc_typeck/src/errors.rs b/compiler/rustc_typeck/src/errors.rs
index 6f00591d54e..44df47e2fa0 100644
--- a/compiler/rustc_typeck/src/errors.rs
+++ b/compiler/rustc_typeck/src/errors.rs
@@ -1,7 +1,7 @@
 //! Errors emitted by typeck.
 use rustc_errors::IntoDiagnostic;
 use rustc_errors::{error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler};
-use rustc_macros::{Diagnostic, LintDiagnostic, SessionSubdiagnostic};
+use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
 use rustc_middle::ty::Ty;
 use rustc_span::{symbol::Ident, Span, Symbol};
 
@@ -194,7 +194,7 @@ pub struct AddressOfTemporaryTaken {
     pub span: Span,
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum AddReturnTypeSuggestion {
     #[suggestion(
         typeck::add_return_type_add,
@@ -217,7 +217,7 @@ pub enum AddReturnTypeSuggestion {
     },
 }
 
-#[derive(SessionSubdiagnostic)]
+#[derive(Subdiagnostic)]
 pub enum ExpectedReturnTypeLabel<'tcx> {
     #[label(typeck::expected_default_return_type)]
     Unit {