diff options
Diffstat (limited to 'crates/ra_hir_ty/src/traits.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index d49f8fb4b..c4dc857bc 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Trait solving using Chalk. | 1 | //! Trait solving using Chalk. |
2 | use std::sync::{Arc, Mutex}; | 2 | use std::sync::{Arc, Mutex}; |
3 | 3 | ||
4 | use chalk_ir::{cast::Cast, family::ChalkIr}; | 4 | use chalk_ir::cast::Cast; |
5 | use hir_def::{expr::ExprId, DefWithBodyId, ImplId, TraitId, TypeAliasId}; | 5 | use hir_def::{expr::ExprId, DefWithBodyId, ImplId, TraitId, TypeAliasId}; |
6 | use log::debug; | 6 | use log::debug; |
7 | use ra_db::{impl_intern_key, salsa, CrateId}; | 7 | use ra_db::{impl_intern_key, salsa, CrateId}; |
@@ -12,7 +12,7 @@ use crate::db::HirDatabase; | |||
12 | 12 | ||
13 | use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; | 13 | use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; |
14 | 14 | ||
15 | use self::chalk::{from_chalk, ToChalk}; | 15 | use self::chalk::{from_chalk, ToChalk, TypeFamily}; |
16 | 16 | ||
17 | pub(crate) mod chalk; | 17 | pub(crate) mod chalk; |
18 | mod builtin; | 18 | mod builtin; |
@@ -20,7 +20,7 @@ mod builtin; | |||
20 | #[derive(Debug, Clone)] | 20 | #[derive(Debug, Clone)] |
21 | pub struct TraitSolver { | 21 | pub struct TraitSolver { |
22 | krate: CrateId, | 22 | krate: CrateId, |
23 | inner: Arc<Mutex<chalk_solve::Solver<ChalkIr>>>, | 23 | inner: Arc<Mutex<chalk_solve::Solver<TypeFamily>>>, |
24 | } | 24 | } |
25 | 25 | ||
26 | /// We need eq for salsa | 26 | /// We need eq for salsa |
@@ -36,8 +36,8 @@ impl TraitSolver { | |||
36 | fn solve( | 36 | fn solve( |
37 | &self, | 37 | &self, |
38 | db: &impl HirDatabase, | 38 | db: &impl HirDatabase, |
39 | goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<ChalkIr>>>, | 39 | goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal<TypeFamily>>>, |
40 | ) -> Option<chalk_solve::Solution<ChalkIr>> { | 40 | ) -> Option<chalk_solve::Solution<TypeFamily>> { |
41 | let context = ChalkContext { db, krate: self.krate }; | 41 | let context = ChalkContext { db, krate: self.krate }; |
42 | debug!("solve goal: {:?}", goal); | 42 | debug!("solve goal: {:?}", goal); |
43 | let mut solver = match self.inner.lock() { | 43 | let mut solver = match self.inner.lock() { |
@@ -201,17 +201,17 @@ pub(crate) fn trait_solve_query( | |||
201 | 201 | ||
202 | fn solution_from_chalk( | 202 | fn solution_from_chalk( |
203 | db: &impl HirDatabase, | 203 | db: &impl HirDatabase, |
204 | solution: chalk_solve::Solution<ChalkIr>, | 204 | solution: chalk_solve::Solution<TypeFamily>, |
205 | ) -> Solution { | 205 | ) -> Solution { |
206 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<ChalkIr>>| { | 206 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<TypeFamily>>| { |
207 | let value = subst | 207 | let value = subst |
208 | .value | 208 | .value |
209 | .parameters | 209 | .parameters |
210 | .into_iter() | 210 | .into_iter() |
211 | .map(|p| { | 211 | .map(|p| { |
212 | let ty = match p { | 212 | let ty = match p.ty() { |
213 | chalk_ir::Parameter(chalk_ir::ParameterKind::Ty(ty)) => from_chalk(db, ty), | 213 | Some(ty) => from_chalk(db, ty.clone()), |
214 | chalk_ir::Parameter(chalk_ir::ParameterKind::Lifetime(_)) => unimplemented!(), | 214 | None => unimplemented!(), |
215 | }; | 215 | }; |
216 | ty | 216 | ty |
217 | }) | 217 | }) |
@@ -291,7 +291,7 @@ impl FnTrait { | |||
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 294 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
295 | pub struct ClosureFnTraitImplData { | 295 | pub struct ClosureFnTraitImplData { |
296 | def: DefWithBodyId, | 296 | def: DefWithBodyId, |
297 | expr: ExprId, | 297 | expr: ExprId, |
@@ -300,7 +300,7 @@ pub struct ClosureFnTraitImplData { | |||
300 | 300 | ||
301 | /// An impl. Usually this comes from an impl block, but some built-in types get | 301 | /// An impl. Usually this comes from an impl block, but some built-in types get |
302 | /// synthetic impls. | 302 | /// synthetic impls. |
303 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 303 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
304 | pub enum Impl { | 304 | pub enum Impl { |
305 | /// A normal impl from an impl block. | 305 | /// A normal impl from an impl block. |
306 | ImplBlock(ImplId), | 306 | ImplBlock(ImplId), |