about summary refs log tree commit diff
path: root/compiler/rustc_macros/src
diff options
context:
space:
mode:
authorJhonny Bill Mena <jhonnybillm@gmail.com>2022-09-18 11:47:31 -0400
committerJhonny Bill Mena <jhonnybillm@gmail.com>2022-09-21 11:39:53 -0400
commit5f91719f75a1012f4b59391fd89a20bb989b2801 (patch)
tree22886e03d601a14d82f4f0c65d8c673afdc35700 /compiler/rustc_macros/src
parenta3396b207093c01065b63b0c58f1e6654629166d (diff)
downloadrust-5f91719f75a1012f4b59391fd89a20bb989b2801.tar.gz
rust-5f91719f75a1012f4b59391fd89a20bb989b2801.zip
UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic
Also renames:
- sym::AddSubdiagnostic to sym:: Subdiagnostic
- rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
Diffstat (limited to 'compiler/rustc_macros/src')
-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
3 files changed, 15 insertions, 15 deletions
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,