aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/db.rs8
-rw-r--r--crates/ra_hir_ty/src/db.rs11
-rw-r--r--crates/ra_hir_ty/src/infer.rs4
-rw-r--r--crates/ra_hir_ty/src/lib.rs2
-rw-r--r--crates/ra_ide/src/change.rs4
5 files changed, 19 insertions, 10 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 0af4a2868..e6079b88d 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -12,10 +12,10 @@ pub use hir_expand::db::{
12 ParseMacroQuery, 12 ParseMacroQuery,
13}; 13};
14pub use hir_ty::db::{ 14pub use hir_ty::db::{
15 AssociatedTyDataQuery, CallableItemSignatureQuery, FieldTypesQuery, GenericDefaultsQuery, 15 AssociatedTyDataQuery, CallableItemSignatureQuery, DoInferQuery, FieldTypesQuery,
16 GenericPredicatesQuery, HirDatabase, HirDatabaseStorage, ImplDatumQuery, ImplsForTraitQuery, 16 GenericDefaultsQuery, GenericPredicatesQuery, HirDatabase, HirDatabaseStorage, ImplDatumQuery,
17 ImplsInCrateQuery, InferQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, 17 ImplsForTraitQuery, ImplsInCrateQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery,
18 ValueTyQuery, 18 TyQuery, ValueTyQuery,
19}; 19};
20 20
21#[test] 21#[test]
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index d52f65b83..eb521c7a0 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -7,6 +7,7 @@ use hir_def::{
7}; 7};
8use ra_arena::map::ArenaMap; 8use ra_arena::map::ArenaMap;
9use ra_db::{salsa, CrateId}; 9use ra_db::{salsa, CrateId};
10use ra_prof::profile;
10 11
11use crate::{ 12use crate::{
12 method_resolution::CrateImplBlocks, 13 method_resolution::CrateImplBlocks,
@@ -18,9 +19,12 @@ use crate::{
18#[salsa::query_group(HirDatabaseStorage)] 19#[salsa::query_group(HirDatabaseStorage)]
19#[salsa::requires(salsa::Database)] 20#[salsa::requires(salsa::Database)]
20pub trait HirDatabase: DefDatabase { 21pub trait HirDatabase: DefDatabase {
21 #[salsa::invoke(crate::infer_query)] 22 #[salsa::transparent]
22 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; 23 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
23 24
25 #[salsa::invoke(crate::do_infer_query)]
26 fn do_infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
27
24 #[salsa::invoke(crate::lower::ty_query)] 28 #[salsa::invoke(crate::lower::ty_query)]
25 #[salsa::cycle(crate::lower::ty_recover)] 29 #[salsa::cycle(crate::lower::ty_recover)]
26 fn ty(&self, def: TyDefId) -> Ty; 30 fn ty(&self, def: TyDefId) -> Ty;
@@ -104,6 +108,11 @@ pub trait HirDatabase: DefDatabase {
104 ) -> Option<crate::traits::Solution>; 108 ) -> Option<crate::traits::Solution>;
105} 109}
106 110
111fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
112 let _p = profile("infer");
113 db.do_infer(def)
114}
115
107#[test] 116#[test]
108fn hir_database_is_object_safe() { 117fn hir_database_is_object_safe() {
109 fn _assert_object_safe(_: &dyn HirDatabase) {} 118 fn _assert_object_safe(_: &dyn HirDatabase) {}
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs
index 37e69599d..e2eda3134 100644
--- a/crates/ra_hir_ty/src/infer.rs
+++ b/crates/ra_hir_ty/src/infer.rs
@@ -62,8 +62,8 @@ mod pat;
62mod coerce; 62mod coerce;
63 63
64/// The entry point of type inference. 64/// The entry point of type inference.
65pub fn infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { 65pub fn do_infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
66 let _p = profile("infer_query"); 66 let _p = profile("do_infer");
67 let resolver = def.resolver(db); 67 let resolver = def.resolver(db);
68 let mut ctx = InferenceContext::new(db, def, resolver); 68 let mut ctx = InferenceContext::new(db, def, resolver);
69 69
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index 55b6dd836..d63f862dc 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -58,7 +58,7 @@ use crate::{
58use display::{HirDisplay, HirFormatter}; 58use display::{HirDisplay, HirFormatter};
59 59
60pub use autoderef::autoderef; 60pub use autoderef::autoderef;
61pub use infer::{infer_query, InferTy, InferenceResult}; 61pub use infer::{do_infer_query, InferTy, InferenceResult};
62pub use lower::CallableDef; 62pub use lower::CallableDef;
63pub use lower::{callable_item_sig, TyDefId, ValueTyDefId}; 63pub use lower::{callable_item_sig, TyDefId, ValueTyDefId};
64pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; 64pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment};
diff --git a/crates/ra_ide/src/change.rs b/crates/ra_ide/src/change.rs
index 4585bf522..f92950b71 100644
--- a/crates/ra_ide/src/change.rs
+++ b/crates/ra_ide/src/change.rs
@@ -273,7 +273,7 @@ impl RootDatabase {
273 self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); 273 self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep);
274 274
275 self.query(hir::db::ExprScopesQuery).sweep(sweep); 275 self.query(hir::db::ExprScopesQuery).sweep(sweep);
276 self.query(hir::db::InferQuery).sweep(sweep); 276 self.query(hir::db::DoInferQuery).sweep(sweep);
277 self.query(hir::db::BodyQuery).sweep(sweep); 277 self.query(hir::db::BodyQuery).sweep(sweep);
278 } 278 }
279 279
@@ -320,7 +320,7 @@ impl RootDatabase {
320 hir::db::LangItemQuery 320 hir::db::LangItemQuery
321 hir::db::DocumentationQuery 321 hir::db::DocumentationQuery
322 hir::db::ExprScopesQuery 322 hir::db::ExprScopesQuery
323 hir::db::InferQuery 323 hir::db::DoInferQuery
324 hir::db::TyQuery 324 hir::db::TyQuery
325 hir::db::ValueTyQuery 325 hir::db::ValueTyQuery
326 hir::db::FieldTypesQuery 326 hir::db::FieldTypesQuery