Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r--crates/hir/src/diagnostics.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index 77a17f1c76..9e4b929dd5 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -129,6 +129,7 @@ diagnostics![AnyDiagnostic<'db> ->
NeedMut,
NonExhaustiveLet,
NonExhaustiveRecordExpr,
+ NonExhaustiveRecordPat,
NoSuchField,
MismatchedArrayPatLen,
DuplicateField,
@@ -407,6 +408,12 @@ pub struct NonExhaustiveRecordExpr {
}
#[derive(Debug)]
+pub struct NonExhaustiveRecordPat {
+ pub pat: InFile<ExprOrPatPtr>,
+ pub variant: Variant,
+}
+
+#[derive(Debug)]
pub struct TypeMismatch<'db> {
pub expr_or_pat: InFile<ExprOrPatPtr>,
pub expected: Type<'db>,
@@ -882,6 +889,10 @@ impl<'db> AnyDiagnostic<'db> {
&InferenceDiagnostic::NonExhaustiveRecordExpr { expr } => {
NonExhaustiveRecordExpr { expr: expr_syntax(expr)? }.into()
}
+ &InferenceDiagnostic::NonExhaustiveRecordPat { pat, variant } => {
+ let pat = pat_syntax(pat)?.map(Into::into);
+ NonExhaustiveRecordPat { pat, variant: variant.into() }.into()
+ }
&InferenceDiagnostic::FunctionalRecordUpdateOnNonStruct { base_expr } => {
FunctionalRecordUpdateOnNonStruct { base_expr: expr_syntax(base_expr)? }.into()
}