diff --git a/crates/hir-ty/src/consteval.rs b/crates/hir-ty/src/consteval.rs index 8b12c5fd890c..5200c1df8c28 100644 --- a/crates/hir-ty/src/consteval.rs +++ b/crates/hir-ty/src/consteval.rs @@ -149,7 +149,7 @@ pub fn unknown_const_as_generic(ty: Ty) -> GenericArg { } /// Interns a constant scalar with the given type -pub fn intern_const_scalar(value: ConstScalar, ty: Ty) -> Const { +pub fn intern_const_scalar(value: ConstScalar<'static>, ty: Ty) -> Const { ConstData { ty, value: ConstValue::Concrete(chalk_ir::ConcreteConst { interned: value }) } .intern(Interner) } diff --git a/crates/hir-ty/src/interner.rs b/crates/hir-ty/src/interner.rs index 57ef5523b433..4e97f4b4ac57 100644 --- a/crates/hir-ty/src/interner.rs +++ b/crates/hir-ty/src/interner.rs @@ -51,7 +51,7 @@ impl_internable!( InternedWrapper, InternedWrapper, InternedWrapper, - InternedWrapper, + InternedWrapper>, InternedWrapper>, InternedWrapper>, InternedWrapper>, @@ -62,7 +62,7 @@ impl chalk_ir::interner::Interner for Interner { type InternedType = Interned>; type InternedLifetime = Interned>; type InternedConst = Interned>; - type InternedConcreteConst = ConstScalar; + type InternedConcreteConst = ConstScalar<'static>; type InternedGenericArg = GenericArgData; // We could do the following, but that saves "only" 20mb on self while increasing inference // time by ~2.5% diff --git a/crates/hir-ty/src/lib.rs b/crates/hir-ty/src/lib.rs index 4ff5cc5588bf..0c88e6c8693c 100644 --- a/crates/hir-ty/src/lib.rs +++ b/crates/hir-ty/src/lib.rs @@ -282,11 +282,10 @@ impl<'db> MemoryMap<'db> { } } -// FIXME(next-solver): add a lifetime to this /// A concrete constant value #[derive(Debug, Clone, PartialEq, Eq)] -pub enum ConstScalar { - Bytes(Box<[u8]>, MemoryMap<'static>), +pub enum ConstScalar<'db> { + Bytes(Box<[u8]>, MemoryMap<'db>), // FIXME: this is a hack to get around chalk not being able to represent unevaluatable // constants UnevaluatedConst(GeneralConstId, Substitution), @@ -298,7 +297,7 @@ pub enum ConstScalar { Unknown, } -impl Hash for ConstScalar { +impl Hash for ConstScalar<'_> { fn hash(&self, state: &mut H) { core::mem::discriminant(self).hash(state); if let ConstScalar::Bytes(b, _) = self {