diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 6 |
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 | ||
11 | mod chalk; | 11 | mod chalk; |
12 | 12 | ||
13 | pub(crate) type Solver = chalk_solve::Solver; | ||
14 | |||
13 | #[derive(Debug, Copy, Clone)] | 15 | #[derive(Debug, Copy, Clone)] |
14 | struct ChalkContext<'a, DB> { | 16 | struct ChalkContext<'a, DB> { |
15 | db: &'a DB, | 17 | db: &'a DB, |
16 | krate: Crate, | 18 | krate: Crate, |
17 | } | 19 | } |
18 | 20 | ||
19 | pub(crate) fn solver(_db: &impl HirDatabase, _krate: Crate) -> Arc<Mutex<chalk_solve::Solver>> { | 21 | pub(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 |