aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/Cargo.toml6
-rw-r--r--crates/ra_hir_ty/src/traits.rs14
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs107
3 files changed, 68 insertions, 59 deletions
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml
index 49cafc539..99e2fe1bf 100644
--- a/crates/ra_hir_ty/Cargo.toml
+++ b/crates/ra_hir_ty/Cargo.toml
@@ -21,9 +21,9 @@ ra_prof = { path = "../ra_prof" }
21ra_syntax = { path = "../ra_syntax" } 21ra_syntax = { path = "../ra_syntax" }
22test_utils = { path = "../test_utils" } 22test_utils = { path = "../test_utils" }
23 23
24chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "af48f302a1f571b3ca418f7c5aa639a144a34f75" } 24chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "2939913fb7bb94ac2a6721087dc086be11410702" }
25chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "af48f302a1f571b3ca418f7c5aa639a144a34f75" } 25chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2939913fb7bb94ac2a6721087dc086be11410702" }
26chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "af48f302a1f571b3ca418f7c5aa639a144a34f75" } 26chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2939913fb7bb94ac2a6721087dc086be11410702" }
27 27
28lalrpop-intern = "0.15.1" 28lalrpop-intern = "0.15.1"
29 29
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs
index 2317fcac3..17aef9490 100644
--- a/crates/ra_hir_ty/src/traits.rs
+++ b/crates/ra_hir_ty/src/traits.rs
@@ -14,7 +14,7 @@ use crate::db::HirDatabase;
14 14
15use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; 15use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk};
16 16
17use self::chalk::{from_chalk, ToChalk, TypeFamily}; 17use self::chalk::{from_chalk, Interner, ToChalk};
18 18
19pub(crate) mod chalk; 19pub(crate) mod chalk;
20mod builtin; 20mod builtin;
@@ -22,7 +22,7 @@ mod builtin;
22#[derive(Debug, Clone)] 22#[derive(Debug, Clone)]
23pub struct TraitSolver { 23pub struct TraitSolver {
24 krate: CrateId, 24 krate: CrateId,
25 inner: Arc<Mutex<chalk_solve::Solver<TypeFamily>>>, 25 inner: Arc<Mutex<chalk_solve::Solver<Interner>>>,
26} 26}
27 27
28/// We need eq for salsa 28/// We need eq for salsa
@@ -38,8 +38,8 @@ impl TraitSolver {
38 fn solve( 38 fn solve(
39 &self, 39 &self,
40 db: &impl HirDatabase, 40 db: &impl HirDatabase,
41 goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<TypeFamily>>>, 41 goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<Interner>>>,
42 ) -> Option<chalk_solve::Solution<TypeFamily>> { 42 ) -> Option<chalk_solve::Solution<Interner>> {
43 let context = ChalkContext { db, krate: self.krate }; 43 let context = ChalkContext { db, krate: self.krate };
44 log::debug!("solve goal: {:?}", goal); 44 log::debug!("solve goal: {:?}", goal);
45 let mut solver = match self.inner.lock() { 45 let mut solver = match self.inner.lock() {
@@ -110,7 +110,7 @@ pub(crate) fn trait_solver_query(
110 TraitSolver { krate, inner: Arc::new(Mutex::new(create_chalk_solver())) } 110 TraitSolver { krate, inner: Arc::new(Mutex::new(create_chalk_solver())) }
111} 111}
112 112
113fn create_chalk_solver() -> chalk_solve::Solver<TypeFamily> { 113fn create_chalk_solver() -> chalk_solve::Solver<Interner> {
114 let solver_choice = 114 let solver_choice =
115 chalk_solve::SolverChoice::SLG { max_size: CHALK_SOLVER_MAX_SIZE, expected_answers: None }; 115 chalk_solve::SolverChoice::SLG { max_size: CHALK_SOLVER_MAX_SIZE, expected_answers: None };
116 solver_choice.into_solver() 116 solver_choice.into_solver()
@@ -242,9 +242,9 @@ pub(crate) fn trait_solve_query(
242 242
243fn solution_from_chalk( 243fn solution_from_chalk(
244 db: &impl HirDatabase, 244 db: &impl HirDatabase,
245 solution: chalk_solve::Solution<TypeFamily>, 245 solution: chalk_solve::Solution<Interner>,
246) -> Solution { 246) -> Solution {
247 let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<TypeFamily>>| { 247 let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| {
248 let value = subst 248 let value = subst
249 .value 249 .value
250 .into_iter() 250 .into_iter()
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index e1e430aeb..5b6c1a62e 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -3,7 +3,7 @@ use std::{fmt, sync::Arc};
3 3
4use log::debug; 4use log::debug;
5 5
6use chalk_ir::{cast::Cast, GoalData, Parameter, PlaceholderIndex, TypeName, UniverseIndex}; 6use chalk_ir::{cast::Cast, Goal, GoalData, Parameter, PlaceholderIndex, TypeName, UniverseIndex};
7 7
8use hir_def::{AssocContainerId, AssocItemId, GenericDefId, HasModule, Lookup, TypeAliasId}; 8use hir_def::{AssocContainerId, AssocItemId, GenericDefId, HasModule, Lookup, TypeAliasId};
9use ra_db::{ 9use ra_db::{
@@ -18,13 +18,14 @@ use crate::{
18}; 18};
19 19
20#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] 20#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21pub struct TypeFamily {} 21pub struct Interner {}
22 22
23impl chalk_ir::family::TypeFamily for TypeFamily { 23impl chalk_ir::interner::Interner for Interner {
24 type InternedType = Box<chalk_ir::TyData<Self>>; 24 type InternedType = Box<chalk_ir::TyData<Self>>;
25 type InternedLifetime = chalk_ir::LifetimeData<Self>; 25 type InternedLifetime = chalk_ir::LifetimeData<Self>;
26 type InternedParameter = chalk_ir::ParameterData<Self>; 26 type InternedParameter = chalk_ir::ParameterData<Self>;
27 type InternedGoal = Arc<GoalData<Self>>; 27 type InternedGoal = Arc<GoalData<Self>>;
28 type InternedGoals = Vec<Goal<Self>>;
28 type InternedSubstitution = Vec<Parameter<Self>>; 29 type InternedSubstitution = Vec<Parameter<Self>>;
29 type DefId = InternId; 30 type DefId = InternId;
30 31
@@ -85,10 +86,18 @@ impl chalk_ir::family::TypeFamily for TypeFamily {
85 Arc::new(goal) 86 Arc::new(goal)
86 } 87 }
87 88
89 fn intern_goals(data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals {
90 data.into_iter().collect()
91 }
92
88 fn goal_data(goal: &Arc<GoalData<Self>>) -> &GoalData<Self> { 93 fn goal_data(goal: &Arc<GoalData<Self>>) -> &GoalData<Self> {
89 goal 94 goal
90 } 95 }
91 96
97 fn goals_data(goals: &Vec<Goal<Interner>>) -> &[Goal<Interner>] {
98 goals
99 }
100
92 fn intern_substitution<E>( 101 fn intern_substitution<E>(
93 data: impl IntoIterator<Item = Result<Parameter<Self>, E>>, 102 data: impl IntoIterator<Item = Result<Parameter<Self>, E>>,
94 ) -> Result<Vec<Parameter<Self>>, E> { 103 ) -> Result<Vec<Parameter<Self>>, E> {
@@ -100,20 +109,20 @@ impl chalk_ir::family::TypeFamily for TypeFamily {
100 } 109 }
101} 110}
102 111
103impl chalk_ir::family::HasTypeFamily for TypeFamily { 112impl chalk_ir::interner::HasInterner for Interner {
104 type TypeFamily = Self; 113 type Interner = Self;
105} 114}
106 115
107pub type AssocTypeId = chalk_ir::AssocTypeId<TypeFamily>; 116pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>;
108pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<TypeFamily>; 117pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<Interner>;
109pub type TraitId = chalk_ir::TraitId<TypeFamily>; 118pub type TraitId = chalk_ir::TraitId<Interner>;
110pub type TraitDatum = chalk_rust_ir::TraitDatum<TypeFamily>; 119pub type TraitDatum = chalk_rust_ir::TraitDatum<Interner>;
111pub type StructId = chalk_ir::StructId<TypeFamily>; 120pub type StructId = chalk_ir::StructId<Interner>;
112pub type StructDatum = chalk_rust_ir::StructDatum<TypeFamily>; 121pub type StructDatum = chalk_rust_ir::StructDatum<Interner>;
113pub type ImplId = chalk_ir::ImplId<TypeFamily>; 122pub type ImplId = chalk_ir::ImplId<Interner>;
114pub type ImplDatum = chalk_rust_ir::ImplDatum<TypeFamily>; 123pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>;
115pub type AssociatedTyValueId = chalk_rust_ir::AssociatedTyValueId; 124pub type AssociatedTyValueId = chalk_rust_ir::AssociatedTyValueId;
116pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue<TypeFamily>; 125pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue<Interner>;
117 126
118pub(super) trait ToChalk { 127pub(super) trait ToChalk {
119 type Chalk; 128 type Chalk;
@@ -129,8 +138,8 @@ where
129} 138}
130 139
131impl ToChalk for Ty { 140impl ToChalk for Ty {
132 type Chalk = chalk_ir::Ty<TypeFamily>; 141 type Chalk = chalk_ir::Ty<Interner>;
133 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Ty<TypeFamily> { 142 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Ty<Interner> {
134 match self { 143 match self {
135 Ty::Apply(apply_ty) => { 144 Ty::Apply(apply_ty) => {
136 let name = apply_ty.ctor.to_chalk(db); 145 let name = apply_ty.ctor.to_chalk(db);
@@ -148,7 +157,7 @@ impl ToChalk for Ty {
148 ui: UniverseIndex::ROOT, 157 ui: UniverseIndex::ROOT,
149 idx: interned_id.as_intern_id().as_usize(), 158 idx: interned_id.as_intern_id().as_usize(),
150 } 159 }
151 .to_ty::<TypeFamily>() 160 .to_ty::<Interner>()
152 } 161 }
153 Ty::Bound(idx) => chalk_ir::TyData::BoundVar(idx as usize).intern(), 162 Ty::Bound(idx) => chalk_ir::TyData::BoundVar(idx as usize).intern(),
154 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), 163 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"),
@@ -169,7 +178,7 @@ impl ToChalk for Ty {
169 } 178 }
170 } 179 }
171 } 180 }
172 fn from_chalk(db: &impl HirDatabase, chalk: chalk_ir::Ty<TypeFamily>) -> Self { 181 fn from_chalk(db: &impl HirDatabase, chalk: chalk_ir::Ty<Interner>) -> Self {
173 match chalk.data().clone() { 182 match chalk.data().clone() {
174 chalk_ir::TyData::Apply(apply_ty) => match apply_ty.name { 183 chalk_ir::TyData::Apply(apply_ty) => match apply_ty.name {
175 TypeName::Error => Ty::Unknown, 184 TypeName::Error => Ty::Unknown,
@@ -205,13 +214,13 @@ impl ToChalk for Ty {
205} 214}
206 215
207impl ToChalk for Substs { 216impl ToChalk for Substs {
208 type Chalk = chalk_ir::Substitution<TypeFamily>; 217 type Chalk = chalk_ir::Substitution<Interner>;
209 218
210 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Substitution<TypeFamily> { 219 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Substitution<Interner> {
211 chalk_ir::Substitution::from(self.iter().map(|ty| ty.clone().to_chalk(db))) 220 chalk_ir::Substitution::from(self.iter().map(|ty| ty.clone().to_chalk(db)))
212 } 221 }
213 222
214 fn from_chalk(db: &impl HirDatabase, parameters: chalk_ir::Substitution<TypeFamily>) -> Substs { 223 fn from_chalk(db: &impl HirDatabase, parameters: chalk_ir::Substitution<Interner>) -> Substs {
215 let tys = parameters 224 let tys = parameters
216 .into_iter() 225 .into_iter()
217 .map(|p| match p.ty() { 226 .map(|p| match p.ty() {
@@ -224,15 +233,15 @@ impl ToChalk for Substs {
224} 233}
225 234
226impl ToChalk for TraitRef { 235impl ToChalk for TraitRef {
227 type Chalk = chalk_ir::TraitRef<TypeFamily>; 236 type Chalk = chalk_ir::TraitRef<Interner>;
228 237
229 fn to_chalk(self: TraitRef, db: &impl HirDatabase) -> chalk_ir::TraitRef<TypeFamily> { 238 fn to_chalk(self: TraitRef, db: &impl HirDatabase) -> chalk_ir::TraitRef<Interner> {
230 let trait_id = self.trait_.to_chalk(db); 239 let trait_id = self.trait_.to_chalk(db);
231 let substitution = self.substs.to_chalk(db); 240 let substitution = self.substs.to_chalk(db);
232 chalk_ir::TraitRef { trait_id, substitution } 241 chalk_ir::TraitRef { trait_id, substitution }
233 } 242 }
234 243
235 fn from_chalk(db: &impl HirDatabase, trait_ref: chalk_ir::TraitRef<TypeFamily>) -> Self { 244 fn from_chalk(db: &impl HirDatabase, trait_ref: chalk_ir::TraitRef<Interner>) -> Self {
236 let trait_ = from_chalk(db, trait_ref.trait_id); 245 let trait_ = from_chalk(db, trait_ref.trait_id);
237 let substs = from_chalk(db, trait_ref.substitution); 246 let substs = from_chalk(db, trait_ref.substitution);
238 TraitRef { trait_, substs } 247 TraitRef { trait_, substs }
@@ -252,9 +261,9 @@ impl ToChalk for hir_def::TraitId {
252} 261}
253 262
254impl ToChalk for TypeCtor { 263impl ToChalk for TypeCtor {
255 type Chalk = TypeName<TypeFamily>; 264 type Chalk = TypeName<Interner>;
256 265
257 fn to_chalk(self, db: &impl HirDatabase) -> TypeName<TypeFamily> { 266 fn to_chalk(self, db: &impl HirDatabase) -> TypeName<Interner> {
258 match self { 267 match self {
259 TypeCtor::AssociatedType(type_alias) => { 268 TypeCtor::AssociatedType(type_alias) => {
260 let type_id = type_alias.to_chalk(db); 269 let type_id = type_alias.to_chalk(db);
@@ -268,7 +277,7 @@ impl ToChalk for TypeCtor {
268 } 277 }
269 } 278 }
270 279
271 fn from_chalk(db: &impl HirDatabase, type_name: TypeName<TypeFamily>) -> TypeCtor { 280 fn from_chalk(db: &impl HirDatabase, type_name: TypeName<Interner>) -> TypeCtor {
272 match type_name { 281 match type_name {
273 TypeName::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()), 282 TypeName::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()),
274 TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)), 283 TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)),
@@ -317,9 +326,9 @@ impl ToChalk for AssocTyValue {
317} 326}
318 327
319impl ToChalk for GenericPredicate { 328impl ToChalk for GenericPredicate {
320 type Chalk = chalk_ir::QuantifiedWhereClause<TypeFamily>; 329 type Chalk = chalk_ir::QuantifiedWhereClause<Interner>;
321 330
322 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::QuantifiedWhereClause<TypeFamily> { 331 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::QuantifiedWhereClause<Interner> {
323 match self { 332 match self {
324 GenericPredicate::Implemented(trait_ref) => { 333 GenericPredicate::Implemented(trait_ref) => {
325 make_binders(chalk_ir::WhereClause::Implemented(trait_ref.to_chalk(db)), 0) 334 make_binders(chalk_ir::WhereClause::Implemented(trait_ref.to_chalk(db)), 0)
@@ -337,7 +346,7 @@ impl ToChalk for GenericPredicate {
337 346
338 fn from_chalk( 347 fn from_chalk(
339 db: &impl HirDatabase, 348 db: &impl HirDatabase,
340 where_clause: chalk_ir::QuantifiedWhereClause<TypeFamily>, 349 where_clause: chalk_ir::QuantifiedWhereClause<Interner>,
341 ) -> GenericPredicate { 350 ) -> GenericPredicate {
342 match where_clause.value { 351 match where_clause.value {
343 chalk_ir::WhereClause::Implemented(tr) => { 352 chalk_ir::WhereClause::Implemented(tr) => {
@@ -353,9 +362,9 @@ impl ToChalk for GenericPredicate {
353} 362}
354 363
355impl ToChalk for ProjectionTy { 364impl ToChalk for ProjectionTy {
356 type Chalk = chalk_ir::AliasTy<TypeFamily>; 365 type Chalk = chalk_ir::AliasTy<Interner>;
357 366
358 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::AliasTy<TypeFamily> { 367 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::AliasTy<Interner> {
359 chalk_ir::AliasTy { 368 chalk_ir::AliasTy {
360 associated_ty_id: self.associated_ty.to_chalk(db), 369 associated_ty_id: self.associated_ty.to_chalk(db),
361 substitution: self.parameters.to_chalk(db), 370 substitution: self.parameters.to_chalk(db),
@@ -364,7 +373,7 @@ impl ToChalk for ProjectionTy {
364 373
365 fn from_chalk( 374 fn from_chalk(
366 db: &impl HirDatabase, 375 db: &impl HirDatabase,
367 projection_ty: chalk_ir::AliasTy<TypeFamily>, 376 projection_ty: chalk_ir::AliasTy<Interner>,
368 ) -> ProjectionTy { 377 ) -> ProjectionTy {
369 ProjectionTy { 378 ProjectionTy {
370 associated_ty: from_chalk(db, projection_ty.associated_ty_id), 379 associated_ty: from_chalk(db, projection_ty.associated_ty_id),
@@ -374,28 +383,28 @@ impl ToChalk for ProjectionTy {
374} 383}
375 384
376impl ToChalk for super::ProjectionPredicate { 385impl ToChalk for super::ProjectionPredicate {
377 type Chalk = chalk_ir::Normalize<TypeFamily>; 386 type Chalk = chalk_ir::Normalize<Interner>;
378 387
379 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Normalize<TypeFamily> { 388 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Normalize<Interner> {
380 chalk_ir::Normalize { alias: self.projection_ty.to_chalk(db), ty: self.ty.to_chalk(db) } 389 chalk_ir::Normalize { alias: self.projection_ty.to_chalk(db), ty: self.ty.to_chalk(db) }
381 } 390 }
382 391
383 fn from_chalk(_db: &impl HirDatabase, _normalize: chalk_ir::Normalize<TypeFamily>) -> Self { 392 fn from_chalk(_db: &impl HirDatabase, _normalize: chalk_ir::Normalize<Interner>) -> Self {
384 unimplemented!() 393 unimplemented!()
385 } 394 }
386} 395}
387 396
388impl ToChalk for Obligation { 397impl ToChalk for Obligation {
389 type Chalk = chalk_ir::DomainGoal<TypeFamily>; 398 type Chalk = chalk_ir::DomainGoal<Interner>;
390 399
391 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::DomainGoal<TypeFamily> { 400 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::DomainGoal<Interner> {
392 match self { 401 match self {
393 Obligation::Trait(tr) => tr.to_chalk(db).cast(), 402 Obligation::Trait(tr) => tr.to_chalk(db).cast(),
394 Obligation::Projection(pr) => pr.to_chalk(db).cast(), 403 Obligation::Projection(pr) => pr.to_chalk(db).cast(),
395 } 404 }
396 } 405 }
397 406
398 fn from_chalk(_db: &impl HirDatabase, _goal: chalk_ir::DomainGoal<TypeFamily>) -> Self { 407 fn from_chalk(_db: &impl HirDatabase, _goal: chalk_ir::DomainGoal<Interner>) -> Self {
399 unimplemented!() 408 unimplemented!()
400 } 409 }
401} 410}
@@ -418,16 +427,16 @@ where
418} 427}
419 428
420impl ToChalk for Arc<super::TraitEnvironment> { 429impl ToChalk for Arc<super::TraitEnvironment> {
421 type Chalk = chalk_ir::Environment<TypeFamily>; 430 type Chalk = chalk_ir::Environment<Interner>;
422 431
423 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Environment<TypeFamily> { 432 fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Environment<Interner> {
424 let mut clauses = Vec::new(); 433 let mut clauses = Vec::new();
425 for pred in &self.predicates { 434 for pred in &self.predicates {
426 if pred.is_error() { 435 if pred.is_error() {
427 // for env, we just ignore errors 436 // for env, we just ignore errors
428 continue; 437 continue;
429 } 438 }
430 let program_clause: chalk_ir::ProgramClause<TypeFamily> = 439 let program_clause: chalk_ir::ProgramClause<Interner> =
431 pred.clone().to_chalk(db).cast(); 440 pred.clone().to_chalk(db).cast();
432 clauses.push(program_clause.into_from_env_clause()); 441 clauses.push(program_clause.into_from_env_clause());
433 } 442 }
@@ -436,7 +445,7 @@ impl ToChalk for Arc<super::TraitEnvironment> {
436 445
437 fn from_chalk( 446 fn from_chalk(
438 _db: &impl HirDatabase, 447 _db: &impl HirDatabase,
439 _env: chalk_ir::Environment<TypeFamily>, 448 _env: chalk_ir::Environment<Interner>,
440 ) -> Arc<super::TraitEnvironment> { 449 ) -> Arc<super::TraitEnvironment> {
441 unimplemented!() 450 unimplemented!()
442 } 451 }
@@ -444,7 +453,7 @@ impl ToChalk for Arc<super::TraitEnvironment> {
444 453
445impl<T: ToChalk> ToChalk for super::InEnvironment<T> 454impl<T: ToChalk> ToChalk for super::InEnvironment<T>
446where 455where
447 T::Chalk: chalk_ir::family::HasTypeFamily<TypeFamily = TypeFamily>, 456 T::Chalk: chalk_ir::interner::HasInterner<Interner = Interner>,
448{ 457{
449 type Chalk = chalk_ir::InEnvironment<T::Chalk>; 458 type Chalk = chalk_ir::InEnvironment<T::Chalk>;
450 459
@@ -522,7 +531,7 @@ fn convert_where_clauses(
522 db: &impl HirDatabase, 531 db: &impl HirDatabase,
523 def: GenericDefId, 532 def: GenericDefId,
524 substs: &Substs, 533 substs: &Substs,
525) -> Vec<chalk_ir::QuantifiedWhereClause<TypeFamily>> { 534) -> Vec<chalk_ir::QuantifiedWhereClause<Interner>> {
526 let generic_predicates = db.generic_predicates(def); 535 let generic_predicates = db.generic_predicates(def);
527 let mut result = Vec::with_capacity(generic_predicates.len()); 536 let mut result = Vec::with_capacity(generic_predicates.len());
528 for pred in generic_predicates.iter() { 537 for pred in generic_predicates.iter() {
@@ -535,7 +544,7 @@ fn convert_where_clauses(
535 result 544 result
536} 545}
537 546
538impl<'a, DB> chalk_solve::RustIrDatabase<TypeFamily> for ChalkContext<'a, DB> 547impl<'a, DB> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a, DB>
539where 548where
540 DB: HirDatabase, 549 DB: HirDatabase,
541{ 550{
@@ -554,7 +563,7 @@ where
554 fn impls_for_trait( 563 fn impls_for_trait(
555 &self, 564 &self,
556 trait_id: TraitId, 565 trait_id: TraitId,
557 parameters: &[Parameter<TypeFamily>], 566 parameters: &[Parameter<Interner>],
558 ) -> Vec<ImplId> { 567 ) -> Vec<ImplId> {
559 debug!("impls_for_trait {:?}", trait_id); 568 debug!("impls_for_trait {:?}", trait_id);
560 let trait_: hir_def::TraitId = from_chalk(self.db, trait_id); 569 let trait_: hir_def::TraitId = from_chalk(self.db, trait_id);
@@ -589,14 +598,14 @@ where
589 fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> { 598 fn associated_ty_value(&self, id: AssociatedTyValueId) -> Arc<AssociatedTyValue> {
590 self.db.associated_ty_value(self.krate, id) 599 self.db.associated_ty_value(self.krate, id)
591 } 600 }
592 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<TypeFamily>> { 601 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<Interner>> {
593 vec![] 602 vec![]
594 } 603 }
595 fn local_impls_to_coherence_check(&self, _trait_id: TraitId) -> Vec<ImplId> { 604 fn local_impls_to_coherence_check(&self, _trait_id: TraitId) -> Vec<ImplId> {
596 // We don't do coherence checking (yet) 605 // We don't do coherence checking (yet)
597 unimplemented!() 606 unimplemented!()
598 } 607 }
599 fn as_struct_id(&self, id: &TypeName<TypeFamily>) -> Option<StructId> { 608 fn as_struct_id(&self, id: &TypeName<Interner>) -> Option<StructId> {
600 match id { 609 match id {
601 TypeName::Struct(struct_id) => Some(*struct_id), 610 TypeName::Struct(struct_id) => Some(*struct_id),
602 _ => None, 611 _ => None,