UPDATE - rename DiagnosticHandler trait to IntoDiagnostic

This commit is contained in:
Jhonny Bill Mena 2022-09-18 11:45:41 -04:00
parent 5b8152807c
commit 19b348fed4
46 changed files with 659 additions and 584 deletions

View file

@ -1,8 +1,8 @@
use rustc_hir::ConstContext;
use rustc_macros::SessionDiagnostic;
use rustc_macros::DiagnosticHandler;
use rustc_span::Span;
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unstable_in_stable)]
pub(crate) struct UnstableInStable {
pub gate: String,
@ -21,14 +21,14 @@ pub(crate) struct UnstableInStable {
pub attr_span: Span,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::thread_local_access, code = "E0625")]
pub(crate) struct NonConstOpErr {
#[primary_span]
pub span: Span,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::static_access, code = "E0013")]
#[help]
pub(crate) struct StaticAccessErr {
@ -40,7 +40,7 @@ pub(crate) struct StaticAccessErr {
pub teach: Option<()>,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::raw_ptr_to_int)]
#[note]
#[note(const_eval::note2)]
@ -49,7 +49,7 @@ pub(crate) struct RawPtrToIntErr {
pub span: Span,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::raw_ptr_comparison)]
#[note]
pub(crate) struct RawPtrComparisonErr {
@ -57,14 +57,14 @@ pub(crate) struct RawPtrComparisonErr {
pub span: Span,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::panic_non_str)]
pub(crate) struct PanicNonStrErr {
#[primary_span]
pub span: Span,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::mut_deref, code = "E0658")]
pub(crate) struct MutDerefErr {
#[primary_span]
@ -72,7 +72,7 @@ pub(crate) struct MutDerefErr {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::transient_mut_borrow, code = "E0658")]
pub(crate) struct TransientMutBorrowErr {
#[primary_span]
@ -80,7 +80,7 @@ pub(crate) struct TransientMutBorrowErr {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::transient_mut_borrow_raw, code = "E0658")]
pub(crate) struct TransientMutBorrowErrRaw {
#[primary_span]
@ -88,7 +88,7 @@ pub(crate) struct TransientMutBorrowErrRaw {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::max_num_nodes_in_const)]
pub(crate) struct MaxNumNodesInConstErr {
#[primary_span]
@ -96,7 +96,7 @@ pub(crate) struct MaxNumNodesInConstErr {
pub global_const_id: String,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unallowed_fn_pointer_call)]
pub(crate) struct UnallowedFnPointerCall {
#[primary_span]
@ -104,7 +104,7 @@ pub(crate) struct UnallowedFnPointerCall {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unstable_const_fn)]
pub(crate) struct UnstableConstFn {
#[primary_span]
@ -112,7 +112,7 @@ pub(crate) struct UnstableConstFn {
pub def_path: String,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unallowed_mutable_refs, code = "E0764")]
pub(crate) struct UnallowedMutableRefs {
#[primary_span]
@ -122,7 +122,7 @@ pub(crate) struct UnallowedMutableRefs {
pub teach: Option<()>,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unallowed_mutable_refs_raw, code = "E0764")]
pub(crate) struct UnallowedMutableRefsRaw {
#[primary_span]
@ -131,7 +131,7 @@ pub(crate) struct UnallowedMutableRefsRaw {
#[note(const_eval::teach_note)]
pub teach: Option<()>,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::non_const_fmt_macro_call, code = "E0015")]
pub(crate) struct NonConstFmtMacroCall {
#[primary_span]
@ -139,7 +139,7 @@ pub(crate) struct NonConstFmtMacroCall {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::non_const_fn_call, code = "E0015")]
pub(crate) struct NonConstFnCall {
#[primary_span]
@ -148,7 +148,7 @@ pub(crate) struct NonConstFnCall {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unallowed_op_in_const_context)]
pub(crate) struct UnallowedOpInConstContext {
#[primary_span]
@ -156,7 +156,7 @@ pub(crate) struct UnallowedOpInConstContext {
pub msg: String,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unallowed_heap_allocations, code = "E0010")]
pub(crate) struct UnallowedHeapAllocations {
#[primary_span]
@ -167,7 +167,7 @@ pub(crate) struct UnallowedHeapAllocations {
pub teach: Option<()>,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::unallowed_inline_asm, code = "E0015")]
pub(crate) struct UnallowedInlineAsm {
#[primary_span]
@ -175,7 +175,7 @@ pub(crate) struct UnallowedInlineAsm {
pub kind: ConstContext,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::interior_mutable_data_refer, code = "E0492")]
pub(crate) struct InteriorMutableDataRefer {
#[primary_span]
@ -188,7 +188,7 @@ pub(crate) struct InteriorMutableDataRefer {
pub teach: Option<()>,
}
#[derive(SessionDiagnostic)]
#[derive(DiagnosticHandler)]
#[diag(const_eval::interior_mutability_borrow)]
pub(crate) struct InteriorMutabilityBorrow {
#[primary_span]