diff options
Diffstat (limited to 'crates/hir_ty/src/traits/chalk/interner.rs')
-rw-r--r-- | crates/hir_ty/src/traits/chalk/interner.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/crates/hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs index fc0f9c201..f9304b7d0 100644 --- a/crates/hir_ty/src/traits/chalk/interner.rs +++ b/crates/hir_ty/src/traits/chalk/interner.rs | |||
@@ -12,6 +12,7 @@ pub struct Interner; | |||
12 | 12 | ||
13 | pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>; | 13 | pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>; |
14 | pub type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>; | 14 | pub type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>; |
15 | pub type ForeignDefId = chalk_ir::ForeignDefId<Interner>; | ||
15 | pub type TraitId = chalk_ir::TraitId<Interner>; | 16 | pub type TraitId = chalk_ir::TraitId<Interner>; |
16 | pub type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>; | 17 | pub type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>; |
17 | pub type AdtId = chalk_ir::AdtId<Interner>; | 18 | pub type AdtId = chalk_ir::AdtId<Interner>; |
@@ -26,7 +27,7 @@ pub type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>; | |||
26 | pub type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>; | 27 | pub type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>; |
27 | 28 | ||
28 | impl chalk_ir::interner::Interner for Interner { | 29 | impl chalk_ir::interner::Interner for Interner { |
29 | type InternedType = Box<chalk_ir::TyData<Self>>; // FIXME use Arc? | 30 | type InternedType = Arc<chalk_ir::TyData<Self>>; |
30 | type InternedLifetime = chalk_ir::LifetimeData<Self>; | 31 | type InternedLifetime = chalk_ir::LifetimeData<Self>; |
31 | type InternedConst = Arc<chalk_ir::ConstData<Self>>; | 32 | type InternedConst = Arc<chalk_ir::ConstData<Self>>; |
32 | type InternedConcreteConst = (); | 33 | type InternedConcreteConst = (); |
@@ -34,7 +35,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
34 | type InternedGoal = Arc<GoalData<Self>>; | 35 | type InternedGoal = Arc<GoalData<Self>>; |
35 | type InternedGoals = Vec<Goal<Self>>; | 36 | type InternedGoals = Vec<Goal<Self>>; |
36 | type InternedSubstitution = Vec<GenericArg<Self>>; | 37 | type InternedSubstitution = Vec<GenericArg<Self>>; |
37 | type InternedProgramClause = chalk_ir::ProgramClauseData<Self>; | 38 | type InternedProgramClause = Arc<chalk_ir::ProgramClauseData<Self>>; |
38 | type InternedProgramClauses = Arc<[chalk_ir::ProgramClause<Self>]>; | 39 | type InternedProgramClauses = Arc<[chalk_ir::ProgramClause<Self>]>; |
39 | type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>; | 40 | type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>; |
40 | type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>; | 41 | type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>; |
@@ -197,11 +198,11 @@ impl chalk_ir::interner::Interner for Interner { | |||
197 | tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt))) | 198 | tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt))) |
198 | } | 199 | } |
199 | 200 | ||
200 | fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { | 201 | fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Arc<chalk_ir::TyData<Self>> { |
201 | Box::new(ty) | 202 | Arc::new(ty) |
202 | } | 203 | } |
203 | 204 | ||
204 | fn ty_data<'a>(&self, ty: &'a Box<chalk_ir::TyData<Self>>) -> &'a chalk_ir::TyData<Self> { | 205 | fn ty_data<'a>(&self, ty: &'a Arc<chalk_ir::TyData<Self>>) -> &'a chalk_ir::TyData<Self> { |
205 | ty | 206 | ty |
206 | } | 207 | } |
207 | 208 | ||
@@ -230,7 +231,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
230 | constant | 231 | constant |
231 | } | 232 | } |
232 | 233 | ||
233 | fn const_eq(&self, _ty: &Box<chalk_ir::TyData<Self>>, _c1: &(), _c2: &()) -> bool { | 234 | fn const_eq(&self, _ty: &Arc<chalk_ir::TyData<Self>>, _c1: &(), _c2: &()) -> bool { |
234 | true | 235 | true |
235 | } | 236 | } |
236 | 237 | ||
@@ -284,13 +285,13 @@ impl chalk_ir::interner::Interner for Interner { | |||
284 | fn intern_program_clause( | 285 | fn intern_program_clause( |
285 | &self, | 286 | &self, |
286 | data: chalk_ir::ProgramClauseData<Self>, | 287 | data: chalk_ir::ProgramClauseData<Self>, |
287 | ) -> chalk_ir::ProgramClauseData<Self> { | 288 | ) -> Arc<chalk_ir::ProgramClauseData<Self>> { |
288 | data | 289 | Arc::new(data) |
289 | } | 290 | } |
290 | 291 | ||
291 | fn program_clause_data<'a>( | 292 | fn program_clause_data<'a>( |
292 | &self, | 293 | &self, |
293 | clause: &'a chalk_ir::ProgramClauseData<Self>, | 294 | clause: &'a Arc<chalk_ir::ProgramClauseData<Self>>, |
294 | ) -> &'a chalk_ir::ProgramClauseData<Self> { | 295 | ) -> &'a chalk_ir::ProgramClauseData<Self> { |
295 | clause | 296 | clause |
296 | } | 297 | } |