@@ -39,16 +39,29 @@ pub struct InternedSubstitutionInner(SmallVec<[GenericArg; 2]>);
39
39
#[ derive( PartialEq , Eq , Hash , Debug ) ]
40
40
pub struct InternedTypeInner ( chalk_ir:: TyData < Interner > ) ;
41
41
42
+ #[ derive( PartialEq , Eq , Hash , Debug ) ]
43
+ pub struct InternedWrapper < T > ( T ) ;
44
+
45
+ impl < T > std:: ops:: Deref for InternedWrapper < T > {
46
+ type Target = T ;
47
+
48
+ fn deref ( & self ) -> & Self :: Target {
49
+ & self . 0
50
+ }
51
+ }
52
+
42
53
impl_internable ! (
43
54
InternedVariableKindsInner ,
44
55
InternedSubstitutionInner ,
45
56
InternedTypeInner ,
57
+ InternedWrapper <chalk_ir:: LifetimeData <Interner >>,
58
+ InternedWrapper <chalk_ir:: ConstData <Interner >>,
46
59
) ;
47
60
48
61
impl chalk_ir:: interner:: Interner for Interner {
49
62
type InternedType = Interned < InternedTypeInner > ;
50
- type InternedLifetime = chalk_ir:: LifetimeData < Self > ;
51
- type InternedConst = Arc < chalk_ir:: ConstData < Self > > ;
63
+ type InternedLifetime = Interned < InternedWrapper < chalk_ir:: LifetimeData < Self > > > ;
64
+ type InternedConst = Interned < InternedWrapper < chalk_ir:: ConstData < Self > > > ;
52
65
type InternedConcreteConst = ( ) ;
53
66
type InternedGenericArg = chalk_ir:: GenericArgData < Self > ;
54
67
type InternedGoal = Arc < GoalData < Self > > ;
@@ -221,22 +234,22 @@ impl chalk_ir::interner::Interner for Interner {
221
234
}
222
235
223
236
fn intern_lifetime ( & self , lifetime : chalk_ir:: LifetimeData < Self > ) -> Self :: InternedLifetime {
224
- lifetime
237
+ Interned :: new ( InternedWrapper ( lifetime) )
225
238
}
226
239
227
240
fn lifetime_data < ' a > (
228
241
& self ,
229
242
lifetime : & ' a Self :: InternedLifetime ,
230
243
) -> & ' a chalk_ir:: LifetimeData < Self > {
231
- lifetime
244
+ & lifetime. 0
232
245
}
233
246
234
247
fn intern_const ( & self , constant : chalk_ir:: ConstData < Self > ) -> Self :: InternedConst {
235
- Arc :: new ( constant)
248
+ Interned :: new ( InternedWrapper ( constant) )
236
249
}
237
250
238
251
fn const_data < ' a > ( & self , constant : & ' a Self :: InternedConst ) -> & ' a chalk_ir:: ConstData < Self > {
239
- constant
252
+ & constant. 0
240
253
}
241
254
242
255
fn const_eq (
0 commit comments