aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/traits
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/traits')
-rw-r--r--crates/hir_ty/src/traits/chalk/interner.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs
index 17e056f03..83787b8c0 100644
--- a/crates/hir_ty/src/traits/chalk/interner.rs
+++ b/crates/hir_ty/src/traits/chalk/interner.rs
@@ -36,13 +36,17 @@ pub struct InternedVariableKindsInner(Vec<chalk_ir::VariableKind<Interner>>);
36#[derive(PartialEq, Eq, Hash, Debug)] 36#[derive(PartialEq, Eq, Hash, Debug)]
37pub struct InternedSubstitutionInner(SmallVec<[GenericArg; 2]>); 37pub struct InternedSubstitutionInner(SmallVec<[GenericArg; 2]>);
38 38
39#[derive(PartialEq, Eq, Hash, Debug)]
40pub struct InternedTypeInner(chalk_ir::TyData<Interner>);
41
39impl_internable!( 42impl_internable!(
40 InternedVariableKindsInner, 43 InternedVariableKindsInner,
41 InternedSubstitutionInner, 44 InternedSubstitutionInner,
45 InternedTypeInner,
42); 46);
43 47
44impl chalk_ir::interner::Interner for Interner { 48impl chalk_ir::interner::Interner for Interner {
45 type InternedType = Arc<chalk_ir::TyData<Self>>; 49 type InternedType = Interned<InternedTypeInner>;
46 type InternedLifetime = chalk_ir::LifetimeData<Self>; 50 type InternedLifetime = chalk_ir::LifetimeData<Self>;
47 type InternedConst = Arc<chalk_ir::ConstData<Self>>; 51 type InternedConst = Arc<chalk_ir::ConstData<Self>>;
48 type InternedConcreteConst = (); 52 type InternedConcreteConst = ();
@@ -209,11 +213,11 @@ impl chalk_ir::interner::Interner for Interner {
209 213
210 fn intern_ty(&self, kind: chalk_ir::TyKind<Self>) -> Self::InternedType { 214 fn intern_ty(&self, kind: chalk_ir::TyKind<Self>) -> Self::InternedType {
211 let flags = kind.compute_flags(self); 215 let flags = kind.compute_flags(self);
212 Arc::new(chalk_ir::TyData { kind, flags }) 216 Interned::new(InternedTypeInner(chalk_ir::TyData { kind, flags }))
213 } 217 }
214 218
215 fn ty_data<'a>(&self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData<Self> { 219 fn ty_data<'a>(&self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData<Self> {
216 ty 220 &ty.0
217 } 221 }
218 222
219 fn intern_lifetime(&self, lifetime: chalk_ir::LifetimeData<Self>) -> Self::InternedLifetime { 223 fn intern_lifetime(&self, lifetime: chalk_ir::LifetimeData<Self>) -> Self::InternedLifetime {