aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-05-01 16:13:33 +0100
committerFlorian Diebold <[email protected]>2019-05-04 17:18:30 +0100
commitef77d8375130d12678d4b2316cc1708c90349dad (patch)
tree37f495100cfcb5a8ce9e0bae8ed4fc50e3b49d80 /crates/ra_hir/src/ty
parentc8a643f090ed88289c7bc17b48078e39b932c8a4 (diff)
Document the peculiarity of the solver query a bit
Also remove the only remaining mention of chalk outside of the ty::traits module.
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/traits.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs
index acb69683c..ac31ca2f6 100644
--- a/crates/ra_hir/src/ty/traits.rs
+++ b/crates/ra_hir/src/ty/traits.rs
@@ -10,13 +10,15 @@ use self::chalk::{ToChalk, from_chalk};
10 10
11mod chalk; 11mod chalk;
12 12
13pub(crate) type Solver = chalk_solve::Solver;
14
13#[derive(Debug, Copy, Clone)] 15#[derive(Debug, Copy, Clone)]
14struct ChalkContext<'a, DB> { 16struct ChalkContext<'a, DB> {
15 db: &'a DB, 17 db: &'a DB,
16 krate: Crate, 18 krate: Crate,
17} 19}
18 20
19pub(crate) fn solver(_db: &impl HirDatabase, _krate: Crate) -> Arc<Mutex<chalk_solve::Solver>> { 21pub(crate) fn solver(_db: &impl HirDatabase, _krate: Crate) -> Arc<Mutex<Solver>> {
20 // krate parameter is just so we cache a unique solver per crate 22 // krate parameter is just so we cache a unique solver per crate
21 let solver_choice = chalk_solve::SolverChoice::SLG { max_size: 10 }; 23 let solver_choice = chalk_solve::SolverChoice::SLG { max_size: 10 };
22 Arc::new(Mutex::new(solver_choice.into_solver())) 24 Arc::new(Mutex::new(solver_choice.into_solver()))
@@ -48,7 +50,7 @@ fn solve(
48 goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal>>, 50 goal: &chalk_ir::UCanonical<chalk_ir::InEnvironment<chalk_ir::Goal>>,
49) -> Option<chalk_solve::Solution> { 51) -> Option<chalk_solve::Solution> {
50 let context = ChalkContext { db, krate }; 52 let context = ChalkContext { db, krate };
51 let solver = db.chalk_solver(krate); 53 let solver = db.solver(krate);
52 let solution = solver.lock().unwrap().solve(&context, goal); 54 let solution = solver.lock().unwrap().solve(&context, goal);
53 eprintln!("solve({:?}) => {:?}", goal, solution); 55 eprintln!("solve({:?}) => {:?}", goal, solution);
54 solution 56 solution