Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer.rs')
-rw-r--r--crates/hir-ty/src/infer.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 42d73d105c..8defeee5e8 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -55,7 +55,7 @@ use triomphe::Arc;
use crate::{
db::HirDatabase,
- error_lifetime, fold_tys,
+ fold_tys,
generics::Generics,
infer::{coerce::CoerceMany, unify::InferenceTable},
lower::ImplTraitLoweringMode,
@@ -327,13 +327,13 @@ pub struct Adjustment {
}
impl Adjustment {
- pub fn borrow(m: Mutability, ty: Ty) -> Self {
- let ty = TyKind::Ref(m, error_lifetime(), ty).intern(Interner);
- Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(m)), target: ty }
+ pub fn borrow(m: Mutability, ty: Ty, lt: Lifetime) -> Self {
+ let ty = TyKind::Ref(m, lt.clone(), ty).intern(Interner);
+ Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(lt, m)), target: ty }
}
}
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum Adjust {
/// Go from ! to any type.
NeverToAny,
@@ -353,18 +353,18 @@ pub enum Adjust {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct OverloadedDeref(pub Option<Mutability>);
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
+#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum AutoBorrow {
/// Converts from T to &T.
- Ref(Mutability),
+ Ref(Lifetime, Mutability),
/// Converts from T to *T.
RawPtr(Mutability),
}
impl AutoBorrow {
- fn mutability(self) -> Mutability {
- let (AutoBorrow::Ref(m) | AutoBorrow::RawPtr(m)) = self;
- m
+ fn mutability(&self) -> Mutability {
+ let (AutoBorrow::Ref(_, m) | AutoBorrow::RawPtr(m)) = self;
+ *m
}
}