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 a399df8276..6b07834231 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -104,6 +104,7 @@ diagnostics![AnyDiagnostic<'db> ->
AwaitOutsideOfAsync,
BreakOutsideOfLoop,
CannotBeDereferenced<'db>,
+ CannotIndexInto<'db>,
CastToUnsized<'db>,
ExpectedArrayOrSlicePat<'db>,
ExpectedFunction<'db>,
@@ -328,6 +329,12 @@ pub struct CannotBeDereferenced<'db> {
}
#[derive(Debug)]
+pub struct CannotIndexInto<'db> {
+ pub expr: InFile<ExprOrPatPtr>,
+ pub found: Type<'db>,
+}
+
+#[derive(Debug)]
pub struct ExplicitDropMethodUse {
pub expr_or_path: Either<InFile<AstPtr<ast::MethodCallExpr>>, InFile<AstPtr<ast::Path>>>,
}
@@ -947,6 +954,10 @@ impl<'db> AnyDiagnostic<'db> {
let expr = expr_syntax(*expr)?;
CannotBeDereferenced { expr, found: Type::new(db, def, found.as_ref()) }.into()
}
+ InferenceDiagnostic::CannotIndexInto { expr, found } => {
+ let expr = expr_syntax(*expr)?;
+ CannotIndexInto { expr, found: Type::new(db, def, found.as_ref()) }.into()
+ }
InferenceDiagnostic::TyDiagnostic { source, diag } => {
let source_map = match source {
InferenceTyDiagnosticSource::Body => source_map,