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 7e4853539d..7c128d6bce 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -102,6 +102,7 @@ macro_rules! diagnostics {
diagnostics![AnyDiagnostic<'db> ->
AwaitOutsideOfAsync,
BreakOutsideOfLoop,
+ CannotBeDereferenced<'db>,
CastToUnsized<'db>,
ExpectedArrayOrSlicePat<'db>,
ExpectedFunction<'db>,
@@ -318,6 +319,12 @@ pub struct ExpectedFunction<'db> {
}
#[derive(Debug)]
+pub struct CannotBeDereferenced<'db> {
+ pub expr: InFile<ExprOrPatPtr>,
+ pub found: Type<'db>,
+}
+
+#[derive(Debug)]
pub struct FunctionalRecordUpdateOnNonStruct {
pub base_expr: InFile<ExprOrPatPtr>,
}
@@ -923,6 +930,10 @@ impl<'db> AnyDiagnostic<'db> {
let cast_ty = Type::new(db, def, cast_ty.as_ref());
InvalidCast { expr, error: *error, expr_ty, cast_ty }.into()
}
+ InferenceDiagnostic::CannotBeDereferenced { expr, found } => {
+ let expr = expr_syntax(*expr)?;
+ CannotBeDereferenced { expr, found: Type::new(db, def, found.as_ref()) }.into()
+ }
InferenceDiagnostic::TyDiagnostic { source, diag } => {
let source_map = match source {
InferenceTyDiagnosticSource::Body => source_map,