summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_borrowck/src/session_diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_borrowck/src/session_diagnostics.rs')
-rw-r--r--compiler/rustc_borrowck/src/session_diagnostics.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs
new file mode 100644
index 000000000..895723d44
--- /dev/null
+++ b/compiler/rustc_borrowck/src/session_diagnostics.rs
@@ -0,0 +1,44 @@
+use rustc_macros::{SessionDiagnostic, SessionSubdiagnostic};
+use rustc_middle::ty::Ty;
+use rustc_span::Span;
+
+#[derive(SessionDiagnostic)]
+#[error(borrowck::move_unsized, code = "E0161")]
+pub(crate) struct MoveUnsized<'tcx> {
+ pub ty: Ty<'tcx>,
+ #[primary_span]
+ #[label]
+ pub span: Span,
+}
+
+#[derive(SessionDiagnostic)]
+#[error(borrowck::higher_ranked_lifetime_error)]
+pub(crate) struct HigherRankedLifetimeError {
+ #[subdiagnostic]
+ pub cause: Option<HigherRankedErrorCause>,
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(SessionSubdiagnostic)]
+pub(crate) enum HigherRankedErrorCause {
+ #[note(borrowck::could_not_prove)]
+ CouldNotProve { predicate: String },
+ #[note(borrowck::could_not_normalize)]
+ CouldNotNormalize { value: String },
+}
+
+#[derive(SessionDiagnostic)]
+#[error(borrowck::higher_ranked_subtype_error)]
+pub(crate) struct HigherRankedSubtypeError {
+ #[primary_span]
+ pub span: Span,
+}
+
+#[derive(SessionDiagnostic)]
+#[error(borrowck::generic_does_not_live_long_enough)]
+pub(crate) struct GenericDoesNotLiveLongEnough {
+ pub kind: String,
+ #[primary_span]
+ pub span: Span,
+}