UPDATE - rename DiagnosticHandler macro to Diagnostic
This commit is contained in:
parent
191fac6826
commit
a3396b2070
34 changed files with 484 additions and 484 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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! {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue