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.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs index 3259abb536..168854de74 100644 --- a/crates/hir/src/diagnostics.rs +++ b/crates/hir/src/diagnostics.rs @@ -81,6 +81,7 @@ diagnostics![AnyDiagnostic<'db> -> NonExhaustiveLet, NonExhaustiveRecordExpr, NoSuchField, + MismatchedArrayPatLen, PatternArgInExternFn, PrivateAssocItem, PrivateField, @@ -233,6 +234,14 @@ pub struct MismatchedTupleStructPatArgCount { } #[derive(Debug)] +pub struct MismatchedArrayPatLen { + pub pat: InFile<ExprOrPatPtr>, + pub expected: u128, + pub found: u128, + pub has_rest: bool, +} + +#[derive(Debug)] pub struct ExpectedFunction<'db> { pub call: InFile<ExprOrPatPtr>, pub found: Type<'db>, @@ -683,6 +692,10 @@ impl<'db> AnyDiagnostic<'db> { let private = private.map(|id| Field { id, parent: variant.into() }); NoSuchField { field: expr_or_pat, private, variant }.into() } + &InferenceDiagnostic::MismatchedArrayPatLen { pat, expected, found, has_rest } => { + let pat = pat_syntax(pat)?.map(Into::into); + MismatchedArrayPatLen { pat, expected, found, has_rest }.into() + } &InferenceDiagnostic::MismatchedArgCount { call_expr, expected, found } => { MismatchedArgCount { call_expr: expr_syntax(call_expr)?, expected, found }.into() } |