Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer/expr.rs')
-rw-r--r--crates/hir-ty/src/infer/expr.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/hir-ty/src/infer/expr.rs b/crates/hir-ty/src/infer/expr.rs
index 3cff0ea896..0a1bfb41d8 100644
--- a/crates/hir-ty/src/infer/expr.rs
+++ b/crates/hir-ty/src/infer/expr.rs
@@ -729,8 +729,16 @@ impl<'db> InferenceContext<'_, 'db> {
self.table.select_obligations_where_possible();
trait_element_ty
}
- // FIXME: Report an error.
- None => self.types.types.error,
+ None => {
+ if self.lang_items.Index.is_some() && self.lang_items.Index_index.is_some()
+ {
+ self.push_diagnostic(InferenceDiagnostic::CannotIndexInto {
+ expr: tgt_expr,
+ found: base_t.store(),
+ });
+ }
+ self.types.types.error
+ }
}
}
Expr::Tuple { exprs, .. } => {