diff options
| author | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-09-18 11:47:31 -0400 |
|---|---|---|
| committer | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-09-21 11:39:53 -0400 |
| commit | 5f91719f75a1012f4b59391fd89a20bb989b2801 (patch) | |
| tree | 22886e03d601a14d82f4f0c65d8c673afdc35700 /compiler/rustc_macros/src/diagnostics/subdiagnostic.rs | |
| parent | a3396b207093c01065b63b0c58f1e6654629166d (diff) | |
| download | rust-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/diagnostics/subdiagnostic.rs')
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/subdiagnostic.rs | 18 |
1 files changed, 9 insertions, 9 deletions
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![]; |
