Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/hir-ty/src/consteval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/hir-ty/src/interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl_internable!(
InternedWrapper<TyData>,
InternedWrapper<LifetimeData>,
InternedWrapper<ConstData>,
InternedWrapper<ConstScalar>,
InternedWrapper<ConstScalar<'static>>,
InternedWrapper<Vec<CanonicalVarKind>>,
InternedWrapper<Box<[ProgramClause]>>,
InternedWrapper<Vec<QuantifiedWhereClause>>,
Expand All @@ -62,7 +62,7 @@ impl chalk_ir::interner::Interner for Interner {
type InternedType = Interned<InternedWrapper<TyData>>;
type InternedLifetime = Interned<InternedWrapper<LifetimeData>>;
type InternedConst = Interned<InternedWrapper<ConstData>>;
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%
Expand Down
7 changes: 3 additions & 4 deletions crates/hir-ty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -298,7 +297,7 @@ pub enum ConstScalar {
Unknown,
}

impl Hash for ConstScalar {
impl Hash for ConstScalar<'_> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
core::mem::discriminant(self).hash(state);
if let ConstScalar::Bytes(b, _) = self {
Expand Down