aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/db.rs10
-rw-r--r--crates/ra_hir_def/src/db.rs12
-rw-r--r--crates/ra_hir_def/src/nameres.rs9
-rw-r--r--crates/ra_hir_ty/src/db.rs12
-rw-r--r--crates/ra_hir_ty/src/infer.rs4
-rw-r--r--crates/ra_hir_ty/src/lib.rs4
-rw-r--r--crates/ra_ide_db/src/change.rs6
7 files changed, 26 insertions, 31 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index ee597cfd2..fcba95091 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -1,7 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3pub use hir_def::db::{ 3pub use hir_def::db::{
4 AttrsQuery, BodyQuery, BodyWithSourceMapQuery, ComputeCrateDefMapQuery, ConstDataQuery, 4 AttrsQuery, BodyQuery, BodyWithSourceMapQuery, ConstDataQuery, CrateDefMapQueryQuery,
5 CrateLangItemsQuery, DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery, 5 CrateLangItemsQuery, DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery,
6 ExprScopesQuery, FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternConstQuery, 6 ExprScopesQuery, FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternConstQuery,
7 InternDatabase, InternDatabaseStorage, InternEnumQuery, InternFunctionQuery, InternImplQuery, 7 InternDatabase, InternDatabaseStorage, InternEnumQuery, InternFunctionQuery, InternImplQuery,
@@ -14,10 +14,10 @@ pub use hir_expand::db::{
14 MacroExpandQuery, ParseMacroQuery, 14 MacroExpandQuery, ParseMacroQuery,
15}; 15};
16pub use hir_ty::db::{ 16pub use hir_ty::db::{
17 AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, DoInferQuery, 17 AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery,
18 FieldTypesQuery, GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, 18 GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase,
19 HirDatabase, HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, 19 HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery,
20 ImplsForTraitQuery, ImplsInCrateQuery, InternAssocTyValueQuery, InternChalkImplQuery, 20 ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery,
21 InternTypeCtorQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, ValueTyQuery, 21 InternTypeCtorQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, ValueTyQuery,
22}; 22};
23 23
diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs
index 2338b2cbe..dcd377aae 100644
--- a/crates/ra_hir_def/src/db.rs
+++ b/crates/ra_hir_def/src/db.rs
@@ -47,11 +47,11 @@ pub trait DefDatabase: InternDatabase + AstDatabase {
47 #[salsa::invoke(RawItems::raw_items_query)] 47 #[salsa::invoke(RawItems::raw_items_query)]
48 fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>; 48 fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>;
49 49
50 #[salsa::transparent] 50 #[salsa::invoke(crate_def_map_wait)]
51 fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>; 51 fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>;
52 52
53 #[salsa::invoke(CrateDefMap::compute_crate_def_map_query)] 53 #[salsa::invoke(CrateDefMap::crate_def_map_query)]
54 fn compute_crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>; 54 fn crate_def_map_query(&self, krate: CrateId) -> Arc<CrateDefMap>;
55 55
56 #[salsa::invoke(StructData::struct_data_query)] 56 #[salsa::invoke(StructData::struct_data_query)]
57 fn struct_data(&self, id: StructId) -> Arc<StructData>; 57 fn struct_data(&self, id: StructId) -> Arc<StructData>;
@@ -109,7 +109,7 @@ pub trait DefDatabase: InternDatabase + AstDatabase {
109 fn documentation(&self, def: AttrDefId) -> Option<Documentation>; 109 fn documentation(&self, def: AttrDefId) -> Option<Documentation>;
110} 110}
111 111
112fn crate_def_map(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { 112fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
113 let _p = profile("wait_crate_def_map"); 113 let _p = profile("crate_def_map:wait");
114 db.compute_crate_def_map(krate) 114 db.crate_def_map_query(krate)
115} 115}
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs
index 166d1c421..628c44c99 100644
--- a/crates/ra_hir_def/src/nameres.rs
+++ b/crates/ra_hir_def/src/nameres.rs
@@ -176,13 +176,8 @@ pub struct ModuleData {
176} 176}
177 177
178impl CrateDefMap { 178impl CrateDefMap {
179 pub(crate) fn compute_crate_def_map_query( 179 pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
180 // Note that this doesn't have `+ AstDatabase`! 180 let _p = profile("crate_def_map_query");
181 // This gurantess that `CrateDefMap` is stable across reparses.
182 db: &impl DefDatabase,
183 krate: CrateId,
184 ) -> Arc<CrateDefMap> {
185 let _p = profile("crate_def_map");
186 let def_map = { 181 let def_map = {
187 let crate_graph = db.crate_graph(); 182 let crate_graph = db.crate_graph();
188 let edition = crate_graph.edition(krate); 183 let edition = crate_graph.edition(krate);
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index 7db28a1f8..74b309005 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -21,11 +21,11 @@ use hir_expand::name::Name;
21#[salsa::query_group(HirDatabaseStorage)] 21#[salsa::query_group(HirDatabaseStorage)]
22#[salsa::requires(salsa::Database)] 22#[salsa::requires(salsa::Database)]
23pub trait HirDatabase: DefDatabase { 23pub trait HirDatabase: DefDatabase {
24 #[salsa::transparent] 24 #[salsa::invoke(infer_wait)]
25 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; 25 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
26 26
27 #[salsa::invoke(crate::do_infer_query)] 27 #[salsa::invoke(crate::infer::infer_query)]
28 fn do_infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; 28 fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
29 29
30 #[salsa::invoke(crate::lower::ty_query)] 30 #[salsa::invoke(crate::lower::ty_query)]
31 #[salsa::cycle(crate::lower::ty_recover)] 31 #[salsa::cycle(crate::lower::ty_recover)]
@@ -103,8 +103,8 @@ pub trait HirDatabase: DefDatabase {
103 ) -> Option<crate::traits::Solution>; 103 ) -> Option<crate::traits::Solution>;
104} 104}
105 105
106fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { 106fn infer_wait(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
107 let _p = profile("wait_infer").detail(|| match def { 107 let _p = profile("infer:wait").detail(|| match def {
108 DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(), 108 DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(),
109 DefWithBodyId::StaticId(it) => { 109 DefWithBodyId::StaticId(it) => {
110 db.static_data(it).name.clone().unwrap_or_else(Name::missing).to_string() 110 db.static_data(it).name.clone().unwrap_or_else(Name::missing).to_string()
@@ -113,7 +113,7 @@ fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
113 db.const_data(it).name.clone().unwrap_or_else(Name::missing).to_string() 113 db.const_data(it).name.clone().unwrap_or_else(Name::missing).to_string()
114 } 114 }
115 }); 115 });
116 db.do_infer(def) 116 db.infer_query(def)
117} 117}
118 118
119#[test] 119#[test]
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs
index 437086ff6..947833412 100644
--- a/crates/ra_hir_ty/src/infer.rs
+++ b/crates/ra_hir_ty/src/infer.rs
@@ -63,8 +63,8 @@ mod pat;
63mod coerce; 63mod coerce;
64 64
65/// The entry point of type inference. 65/// The entry point of type inference.
66pub fn do_infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { 66pub(crate) fn infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
67 let _p = profile("infer"); 67 let _p = profile("infer_query");
68 let resolver = def.resolver(db); 68 let resolver = def.resolver(db);
69 let mut ctx = InferenceContext::new(db, def, resolver); 69 let mut ctx = InferenceContext::new(db, def, resolver);
70 70
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index ca194f806..4127f1a8d 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -26,7 +26,7 @@ pub mod traits;
26pub mod method_resolution; 26pub mod method_resolution;
27mod op; 27mod op;
28mod lower; 28mod lower;
29mod infer; 29pub(crate) mod infer;
30pub mod display; 30pub mod display;
31pub(crate) mod utils; 31pub(crate) mod utils;
32pub mod db; 32pub mod db;
@@ -57,7 +57,7 @@ use crate::{
57use display::HirDisplay; 57use display::HirDisplay;
58 58
59pub use autoderef::autoderef; 59pub use autoderef::autoderef;
60pub use infer::{do_infer_query, InferTy, InferenceResult}; 60pub use infer::{InferTy, InferenceResult};
61pub use lower::CallableDef; 61pub use lower::CallableDef;
62pub use lower::{ 62pub use lower::{
63 callable_item_sig, ImplTraitLoweringMode, TyDefId, TyLoweringContext, ValueTyDefId, 63 callable_item_sig, ImplTraitLoweringMode, TyDefId, TyLoweringContext, ValueTyDefId,
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs
index de5c6eb8f..8b5be9d21 100644
--- a/crates/ra_ide_db/src/change.rs
+++ b/crates/ra_ide_db/src/change.rs
@@ -279,7 +279,7 @@ impl RootDatabase {
279 self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); 279 self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep);
280 280
281 self.query(hir::db::ExprScopesQuery).sweep(sweep); 281 self.query(hir::db::ExprScopesQuery).sweep(sweep);
282 self.query(hir::db::DoInferQuery).sweep(sweep); 282 self.query(hir::db::InferQueryQuery).sweep(sweep);
283 self.query(hir::db::BodyQuery).sweep(sweep); 283 self.query(hir::db::BodyQuery).sweep(sweep);
284 } 284 }
285 285
@@ -318,7 +318,7 @@ impl RootDatabase {
318 318
319 // DefDatabase 319 // DefDatabase
320 hir::db::RawItemsQuery 320 hir::db::RawItemsQuery
321 hir::db::ComputeCrateDefMapQuery 321 hir::db::CrateDefMapQueryQuery
322 hir::db::StructDataQuery 322 hir::db::StructDataQuery
323 hir::db::UnionDataQuery 323 hir::db::UnionDataQuery
324 hir::db::EnumDataQuery 324 hir::db::EnumDataQuery
@@ -350,7 +350,7 @@ impl RootDatabase {
350 hir::db::InternImplQuery 350 hir::db::InternImplQuery
351 351
352 // HirDatabase 352 // HirDatabase
353 hir::db::DoInferQuery 353 hir::db::InferQueryQuery
354 hir::db::TyQuery 354 hir::db::TyQuery
355 hir::db::ValueTyQuery 355 hir::db::ValueTyQuery
356 hir::db::ImplSelfTyQuery 356 hir::db::ImplSelfTyQuery