aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/autoderef.rs5
-rw-r--r--crates/hir_ty/src/db.rs19
2 files changed, 19 insertions, 5 deletions
diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs
index 6d2cf4619..2c07494a9 100644
--- a/crates/hir_ty/src/autoderef.rs
+++ b/crates/hir_ty/src/autoderef.rs
@@ -85,10 +85,7 @@ fn deref_by_trait(
85 environment: ty.environment.clone(), 85 environment: ty.environment.clone(),
86 }, 86 },
87 }; 87 };
88 if { 88 if db.trait_solve(krate, implements_goal).is_none() {
89 let _p = profile::span("db.trait_solve");
90 db.trait_solve(krate, implements_goal).is_none()
91 } {
92 return None; 89 return None;
93 } 90 }
94 91
diff --git a/crates/hir_ty/src/db.rs b/crates/hir_ty/src/db.rs
index 1690926ad..cf67d4266 100644
--- a/crates/hir_ty/src/db.rs
+++ b/crates/hir_ty/src/db.rs
@@ -128,13 +128,21 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
128 id: chalk_db::AssociatedTyValueId, 128 id: chalk_db::AssociatedTyValueId,
129 ) -> Arc<chalk_db::AssociatedTyValue>; 129 ) -> Arc<chalk_db::AssociatedTyValue>;
130 130
131 #[salsa::invoke(crate::traits::trait_solve_query)] 131 #[salsa::invoke(trait_solve_wait)]
132 #[salsa::transparent]
132 fn trait_solve( 133 fn trait_solve(
133 &self, 134 &self,
134 krate: CrateId, 135 krate: CrateId,
135 goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>, 136 goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
136 ) -> Option<crate::Solution>; 137 ) -> Option<crate::Solution>;
137 138
139 #[salsa::invoke(crate::traits::trait_solve_query)]
140 fn trait_solve_query(
141 &self,
142 krate: CrateId,
143 goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
144 ) -> Option<crate::Solution>;
145
138 #[salsa::invoke(chalk_db::program_clauses_for_chalk_env_query)] 146 #[salsa::invoke(chalk_db::program_clauses_for_chalk_env_query)]
139 fn program_clauses_for_chalk_env( 147 fn program_clauses_for_chalk_env(
140 &self, 148 &self,
@@ -156,6 +164,15 @@ fn infer_wait(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult>
156 db.infer_query(def) 164 db.infer_query(def)
157} 165}
158 166
167fn trait_solve_wait(
168 db: &dyn HirDatabase,
169 krate: CrateId,
170 goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
171) -> Option<crate::Solution> {
172 let _p = profile::span("trait_solve::wait");
173 db.trait_solve_query(krate, goal)
174}
175
159#[test] 176#[test]
160fn hir_database_is_object_safe() { 177fn hir_database_is_object_safe() {
161 fn _assert_object_safe(_: &dyn HirDatabase) {} 178 fn _assert_object_safe(_: &dyn HirDatabase) {}