4
4
use super :: tls;
5
5
use base_db:: salsa:: InternId ;
6
6
use chalk_ir:: { GenericArg , Goal , GoalData } ;
7
- use hir_def:: TypeAliasId ;
7
+ use hir_def:: {
8
+ intern:: { impl_internable, InternStorage , Internable , Interned } ,
9
+ TypeAliasId ,
10
+ } ;
8
11
use smallvec:: SmallVec ;
9
12
use std:: { fmt, sync:: Arc } ;
10
13
@@ -26,6 +29,11 @@ pub(crate) type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>;
26
29
pub ( crate ) type OpaqueTyDatum = chalk_solve:: rust_ir:: OpaqueTyDatum < Interner > ;
27
30
pub ( crate ) type Variances = chalk_ir:: Variances < Interner > ;
28
31
32
+ #[ derive( PartialEq , Eq , Hash , Debug ) ]
33
+ pub struct InternedVariableKindsInner ( Vec < chalk_ir:: VariableKind < Interner > > ) ;
34
+
35
+ impl_internable ! ( InternedVariableKindsInner , ) ;
36
+
29
37
impl chalk_ir:: interner:: Interner for Interner {
30
38
type InternedType = Arc < chalk_ir:: TyData < Self > > ;
31
39
type InternedLifetime = chalk_ir:: LifetimeData < Self > ;
@@ -38,7 +46,7 @@ impl chalk_ir::interner::Interner for Interner {
38
46
type InternedProgramClause = Arc < chalk_ir:: ProgramClauseData < Self > > ;
39
47
type InternedProgramClauses = Arc < [ chalk_ir:: ProgramClause < Self > ] > ;
40
48
type InternedQuantifiedWhereClauses = Vec < chalk_ir:: QuantifiedWhereClause < Self > > ;
41
- type InternedVariableKinds = Vec < chalk_ir :: VariableKind < Self > > ;
49
+ type InternedVariableKinds = Interned < InternedVariableKindsInner > ;
42
50
type InternedCanonicalVarKinds = Vec < chalk_ir:: CanonicalVarKind < Self > > ;
43
51
type InternedConstraints = Vec < chalk_ir:: InEnvironment < chalk_ir:: Constraint < Self > > > ;
44
52
type InternedVariances = Arc < [ chalk_ir:: Variance ] > ;
@@ -322,14 +330,16 @@ impl chalk_ir::interner::Interner for Interner {
322
330
& self ,
323
331
data : impl IntoIterator < Item = Result < chalk_ir:: VariableKind < Self > , E > > ,
324
332
) -> Result < Self :: InternedVariableKinds , E > {
325
- data. into_iter ( ) . collect ( )
333
+ Ok ( Interned :: new ( InternedVariableKindsInner (
334
+ data. into_iter ( ) . collect :: < Result < Vec < _ > , E > > ( ) ?,
335
+ ) ) )
326
336
}
327
337
328
338
fn variable_kinds_data < ' a > (
329
339
& self ,
330
340
parameter_kinds : & ' a Self :: InternedVariableKinds ,
331
341
) -> & ' a [ chalk_ir:: VariableKind < Self > ] {
332
- & parameter_kinds
342
+ & parameter_kinds. as_ref ( ) . 0
333
343
}
334
344
335
345
fn intern_canonical_var_kinds < E > (
0 commit comments