aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/traits.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-09 13:11:37 +0100
committerFlorian Diebold <[email protected]>2021-04-09 13:11:37 +0100
commit743faa21e74cc5b627935e2c4c3365807a5c722f (patch)
tree28504dbaaa7238c5d7d64d2371dc3b672cb21e16 /crates/hir_ty/src/traits.rs
parent99ed68a109c9f7e0dc6a82ccb5bf854d60943957 (diff)
Reorganize hir_ty modules
Chalk isn't really a 'traits' thing anymore, so it doesn't make sense to have all the Chalk-related stuff in submodules of `traits`.
Diffstat (limited to 'crates/hir_ty/src/traits.rs')
-rw-r--r--crates/hir_ty/src/traits.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/hir_ty/src/traits.rs b/crates/hir_ty/src/traits.rs
index 1cda72d22..5f8666d90 100644
--- a/crates/hir_ty/src/traits.rs
+++ b/crates/hir_ty/src/traits.rs
@@ -9,20 +9,16 @@ use stdx::panic_context;
9 9
10use crate::{ 10use crate::{
11 db::HirDatabase, AliasEq, AliasTy, Canonical, DomainGoal, Guidance, HirDisplay, InEnvironment, 11 db::HirDatabase, AliasEq, AliasTy, Canonical, DomainGoal, Guidance, HirDisplay, InEnvironment,
12 Solution, TraitRefExt, Ty, TyKind, WhereClause, 12 Solution, TraitRefExt, Ty, TyKind, WhereClause, Interner,
13}; 13};
14 14
15use self::chalk::Interner;
16
17pub(crate) mod chalk;
18
19/// This controls how much 'time' we give the Chalk solver before giving up. 15/// This controls how much 'time' we give the Chalk solver before giving up.
20const CHALK_SOLVER_FUEL: i32 = 100; 16const CHALK_SOLVER_FUEL: i32 = 100;
21 17
22#[derive(Debug, Copy, Clone)] 18#[derive(Debug, Copy, Clone)]
23struct ChalkContext<'a> { 19pub(crate) struct ChalkContext<'a> {
24 db: &'a dyn HirDatabase, 20 pub(crate) db: &'a dyn HirDatabase,
25 krate: CrateId, 21 pub(crate) krate: CrateId,
26} 22}
27 23
28fn create_chalk_solver() -> chalk_recursive::RecursiveSolver<Interner> { 24fn create_chalk_solver() -> chalk_recursive::RecursiveSolver<Interner> {
@@ -148,7 +144,7 @@ fn solve(
148 // don't set the TLS for Chalk unless Chalk debugging is active, to make 144 // don't set the TLS for Chalk unless Chalk debugging is active, to make
149 // extra sure we only use it for debugging 145 // extra sure we only use it for debugging
150 let solution = 146 let solution =
151 if is_chalk_debug() { chalk::tls::set_current_program(db, solve) } else { solve() }; 147 if is_chalk_debug() { crate::tls::set_current_program(db, solve) } else { solve() };
152 148
153 solution 149 solution
154} 150}