diff options
| author | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-09-18 11:46:56 -0400 |
|---|---|---|
| committer | Jhonny Bill Mena <jhonnybillm@gmail.com> | 2022-09-21 11:39:53 -0400 |
| commit | a3396b207093c01065b63b0c58f1e6654629166d (patch) | |
| tree | 7d2b5bd979e9a1da8a2e10404676004876edc147 /compiler/rustc_macros/src | |
| parent | 191fac68266b73158ff048c83556ea91cbf977fd (diff) | |
| download | rust-a3396b207093c01065b63b0c58f1e6654629166d.tar.gz rust-a3396b207093c01065b63b0c58f1e6654629166d.zip | |
UPDATE - rename DiagnosticHandler macro to Diagnostic
Diffstat (limited to 'compiler/rustc_macros/src')
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/diagnostic.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/mod.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/lib.rs | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic.rs b/compiler/rustc_macros/src/diagnostics/diagnostic.rs index c5b5edab816..c1aae04fcee 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic.rs @@ -21,7 +21,7 @@ impl<'a> SessionDiagnosticDerive<'a> { builder: DiagnosticDeriveBuilder { diag, fields: build_field_mapping(&structure), - kind: DiagnosticDeriveKind::DiagnosticHandler, + kind: DiagnosticDeriveKind::Diagnostic, code: None, slug: None, }, @@ -72,7 +72,7 @@ impl<'a> SessionDiagnosticDerive<'a> { } else { span_err( ast.span().unwrap(), - "`#[derive(DiagnosticHandler)]` can only be used on structs", + "`#[derive(Diagnostic)]` can only be used on structs", ) .emit(); diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs index 4af3fd23624..32d6ba62a0d 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs @@ -21,12 +21,12 @@ use synstructure::{BindingInfo, Structure}; /// What kind of diagnostic is being derived - a fatal/error/warning or a lint? #[derive(Copy, Clone, PartialEq, Eq)] pub(crate) enum DiagnosticDeriveKind { - DiagnosticHandler, + Diagnostic, LintDiagnostic, } /// Tracks persistent information required for building up individual calls to diagnostic methods -/// for generated diagnostic derives - both `DiagnosticHandler` for fatal/errors/warnings and +/// for generated diagnostic derives - both `Diagnostic` for fatal/errors/warnings and /// `LintDiagnostic` for lints. pub(crate) struct DiagnosticDeriveBuilder { /// The identifier to use for the generated `DiagnosticBuilder` instance. @@ -333,7 +333,7 @@ impl DiagnosticDeriveBuilder { } "primary_span" => { match self.kind { - DiagnosticDeriveKind::DiagnosticHandler => { + DiagnosticDeriveKind::Diagnostic => { report_error_if_not_applied_to_span(attr, &info)?; Ok(quote! { diff --git a/compiler/rustc_macros/src/diagnostics/mod.rs b/compiler/rustc_macros/src/diagnostics/mod.rs index 162089c881e..1d5b32c2556 100644 --- a/compiler/rustc_macros/src/diagnostics/mod.rs +++ b/compiler/rustc_macros/src/diagnostics/mod.rs @@ -12,7 +12,7 @@ use quote::format_ident; use subdiagnostic::SessionSubdiagnosticDerive; use synstructure::Structure; -/// Implements `#[derive(DiagnosticHandler)]`, which allows for errors to be specified as a struct, +/// Implements `#[derive(Diagnostic)]`, which allows for errors to be specified as a struct, /// independent from the actual diagnostics emitting code. /// /// ```ignore (rust) @@ -22,7 +22,7 @@ use synstructure::Structure; /// # use rustc_span::{symbol::Ident, Span}; /// # extern crate rust_middle; /// # use rustc_middle::ty::Ty; -/// #[derive(DiagnosticHandler)] +/// #[derive(Diagnostic)] /// #[diag(borrowck::move_out_of_borrow, code = "E0505")] /// pub struct MoveOutOfBorrowError<'tcx> { /// pub name: Ident, @@ -56,7 +56,7 @@ use synstructure::Structure; /// }); /// ``` /// -/// See rustc dev guide for more examples on using the `#[derive(DiagnosticHandler)]`: +/// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`: /// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html> pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream { SessionDiagnosticDerive::new(format_ident!("diag"), format_ident!("handler"), s).into_tokens() diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 13305782ff1..9dd7ccad8bb 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -127,7 +127,7 @@ decl_derive!([TypeFoldable, attributes(type_foldable)] => type_foldable::type_fo decl_derive!([TypeVisitable, attributes(type_visitable)] => type_visitable::type_visitable_derive); decl_derive!([Lift, attributes(lift)] => lift::lift_derive); decl_derive!( - [DiagnosticHandler, attributes( + [Diagnostic, attributes( // struct attributes diag, help, |
