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.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index f3188c9aad..edd24442c4 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -104,6 +104,7 @@ diagnostics![AnyDiagnostic<'db> ->
AwaitOutsideOfAsync,
BreakOutsideOfLoop,
CannotBeDereferenced<'db>,
+ CannotBorrowAsMutable,
CannotImplicitlyDerefTraitObject<'db>,
CannotIndexInto<'db>,
CastToUnsized<'db>,
@@ -336,6 +337,11 @@ pub struct CannotBeDereferenced<'db> {
}
#[derive(Debug)]
+pub struct CannotBorrowAsMutable {
+ pub pat: InFile<ExprOrPatPtr>,
+}
+
+#[derive(Debug)]
pub struct CannotImplicitlyDerefTraitObject<'db> {
pub pat: InFile<ExprOrPatPtr>,
pub found: Type<'db>,
@@ -980,6 +986,10 @@ impl<'db> AnyDiagnostic<'db> {
let expr = expr_syntax(*expr)?;
CannotBeDereferenced { expr, found: new_ty(found.as_ref()) }.into()
}
+ InferenceDiagnostic::CannotBorrowAsMutable { pat } => {
+ let pat = pat_syntax(*pat)?.map(Into::into);
+ CannotBorrowAsMutable { pat }.into()
+ }
InferenceDiagnostic::CannotImplicitlyDerefTraitObject { pat, found } => {
let pat = pat_syntax(*pat)?.map(Into::into);
CannotImplicitlyDerefTraitObject { pat, found: new_ty(found.as_ref()) }.into()