about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/errors.rs
diff options
context:
space:
mode:
authorPeter Medus <16763503+Facel3ss1@users.noreply.github.com>2022-08-19 00:04:31 +0100
committerPeter Medus <16763503+Facel3ss1@users.noreply.github.com>2022-08-26 14:36:51 +0100
commit01c1616b2568a712dfa3e4dc6af233f5152ff362 (patch)
tree93b6bb0e06f90c62d2e78e964d0ae4d251ee7210 /compiler/rustc_ty_utils/src/errors.rs
parent8a13871b69924b74cfa1d737f2894068b37ea7ea (diff)
downloadrust-01c1616b2568a712dfa3e4dc6af233f5152ff362.tar.gz
rust-01c1616b2568a712dfa3e4dc6af233f5152ff362.zip
Migrate rustc_ty_utils to use SessionDiagnostic
Diffstat (limited to 'compiler/rustc_ty_utils/src/errors.rs')
-rw-r--r--compiler/rustc_ty_utils/src/errors.rs69
1 files changed, 69 insertions, 0 deletions
diff --git a/compiler/rustc_ty_utils/src/errors.rs b/compiler/rustc_ty_utils/src/errors.rs
new file mode 100644
index 00000000000..3a8ef96c991
--- /dev/null
+++ b/compiler/rustc_ty_utils/src/errors.rs
@@ -0,0 +1,69 @@
+//! Errors emitted by ty_utils
+
+use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic};
+use rustc_middle::ty::Ty;
+use rustc_span::Span;
+
+#[derive(SessionDiagnostic)]
+#[diag(ty_utils::needs_drop_overflow)]
+pub struct NeedsDropOverflow<'tcx> {
+    pub query_ty: Ty<'tcx>,
+}
+
+#[derive(SessionDiagnostic)]
+#[diag(ty_utils::generic_constant_too_complex)]
+#[help]
+pub struct GenericConstantTooComplex {
+    #[primary_span]
+    pub span: Span,
+    #[note(ty_utils::maybe_supported)]
+    pub maybe_supported: Option<()>,
+    #[subdiagnostic]
+    pub sub: GenericConstantTooComplexSub,
+}
+
+#[derive(SessionSubdiagnostic)]
+pub enum GenericConstantTooComplexSub {
+    #[label(ty_utils::borrow_not_supported)]
+    BorrowNotSupported(#[primary_span] Span),
+    #[label(ty_utils::address_and_deref_not_supported)]
+    AddressAndDerefNotSupported(#[primary_span] Span),
+    #[label(ty_utils::array_not_supported)]
+    ArrayNotSupported(#[primary_span] Span),
+    #[label(ty_utils::block_not_supported)]
+    BlockNotSupported(#[primary_span] Span),
+    #[label(ty_utils::never_to_any_not_supported)]
+    NeverToAnyNotSupported(#[primary_span] Span),
+    #[label(ty_utils::tuple_not_supported)]
+    TupleNotSupported(#[primary_span] Span),
+    #[label(ty_utils::index_not_supported)]
+    IndexNotSupported(#[primary_span] Span),
+    #[label(ty_utils::field_not_supported)]
+    FieldNotSupported(#[primary_span] Span),
+    #[label(ty_utils::const_block_not_supported)]
+    ConstBlockNotSupported(#[primary_span] Span),
+    #[label(ty_utils::adt_not_supported)]
+    AdtNotSupported(#[primary_span] Span),
+    #[label(ty_utils::pointer_not_supported)]
+    PointerNotSupported(#[primary_span] Span),
+    #[label(ty_utils::yield_not_supported)]
+    YieldNotSupported(#[primary_span] Span),
+    #[label(ty_utils::loop_not_supported)]
+    LoopNotSupported(#[primary_span] Span),
+    #[label(ty_utils::box_not_supported)]
+    BoxNotSupported(#[primary_span] Span),
+    #[label(ty_utils::binary_not_supported)]
+    BinaryNotSupported(#[primary_span] Span),
+    #[label(ty_utils::logical_op_not_supported)]
+    LogicalOpNotSupported(#[primary_span] Span),
+    #[label(ty_utils::assign_not_supported)]
+    AssignNotSupported(#[primary_span] Span),
+    #[label(ty_utils::closure_and_return_not_supported)]
+    ClosureAndReturnNotSupported(#[primary_span] Span),
+    #[label(ty_utils::control_flow_not_supported)]
+    ControlFlowNotSupported(#[primary_span] Span),
+    #[label(ty_utils::inline_asm_not_supported)]
+    InlineAsmNotSupported(#[primary_span] Span),
+    #[label(ty_utils::operation_not_supported)]
+    OperationNotSupported(#[primary_span] Span),
+}