aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-05-21 18:57:36 +0100
committerAleksey Kladov <[email protected]>2019-05-21 18:57:36 +0100
commited943adb29e6eddb482377a21908a8ed66c6cc21 (patch)
tree5922c706e49579074a4c339c512c5bb5f8f7326e /crates/ra_hir/src
parent26463f189ff75e92990375ee5ae08d3903d39e66 (diff)
re-enable chalk
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/ty/traits.rs33
1 files changed, 16 insertions, 17 deletions
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index 908c00209..f39749cab 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -78,24 +78,23 @@ pub enum Obligation {
78 78
79/// Check using Chalk whether trait is implemented for given parameters including `Self` type. 79/// Check using Chalk whether trait is implemented for given parameters including `Self` type.
80pub(crate) fn implements_query( 80pub(crate) fn implements_query(
81 _db: &impl HirDatabase, 81 db: &impl HirDatabase,
82 _krate: Crate, 82 krate: Crate,
83 _trait_ref: Canonical<TraitRef>, 83 trait_ref: Canonical<TraitRef>,
84) -> Option<Solution> { 84) -> Option<Solution> {
85 return None; 85 let _p = profile("implements_query");
86 // let _p = profile("implements_query"); 86 let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast();
87 // let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast(); 87 debug!("goal: {:?}", goal);
88 // debug!("goal: {:?}", goal); 88 let env = chalk_ir::Environment::new();
89 // let env = chalk_ir::Environment::new(); 89 let in_env = chalk_ir::InEnvironment::new(&env, goal);
90 // let in_env = chalk_ir::InEnvironment::new(&env, goal); 90 let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT);
91 // let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT); 91 let canonical =
92 // let canonical = 92 chalk_ir::Canonical { value: in_env, binders: vec![parameter; trait_ref.num_vars] };
93 // chalk_ir::Canonical { value: in_env, binders: vec![parameter; trait_ref.num_vars] }; 93 // We currently don't deal with universes (I think / hope they're not yet
94 // // We currently don't deal with universes (I think / hope they're not yet 94 // relevant for our use cases?)
95 // // relevant for our use cases?) 95 let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 };
96 // let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; 96 let solution = solve(db, krate, &u_canonical);
97 // let solution = solve(db, krate, &u_canonical); 97 solution.map(|solution| solution_from_chalk(db, solution))
98 // solution.map(|solution| solution_from_chalk(db, solution))
99} 98}
100 99
101fn solution_from_chalk(db: &impl HirDatabase, solution: chalk_solve::Solution) -> Solution { 100fn solution_from_chalk(db: &impl HirDatabase, solution: chalk_solve::Solution) -> Solution {