From 9abf0d9659d0d48036c4172e29fe33770134dd61 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 7 Mar 2020 00:11:52 +0100 Subject: Normalize waiting queries names --- crates/ra_hir/src/db.rs | 10 +++++----- crates/ra_hir_def/src/db.rs | 12 ++++++------ crates/ra_hir_def/src/nameres.rs | 9 ++------- crates/ra_hir_ty/src/db.rs | 12 ++++++------ crates/ra_hir_ty/src/infer.rs | 4 ++-- crates/ra_hir_ty/src/lib.rs | 4 ++-- crates/ra_ide_db/src/change.rs | 6 +++--- 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 @@ //! FIXME: write short doc here pub use hir_def::db::{ - AttrsQuery, BodyQuery, BodyWithSourceMapQuery, ComputeCrateDefMapQuery, ConstDataQuery, + AttrsQuery, BodyQuery, BodyWithSourceMapQuery, ConstDataQuery, CrateDefMapQueryQuery, CrateLangItemsQuery, DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery, ExprScopesQuery, FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternConstQuery, InternDatabase, InternDatabaseStorage, InternEnumQuery, InternFunctionQuery, InternImplQuery, @@ -14,10 +14,10 @@ pub use hir_expand::db::{ MacroExpandQuery, ParseMacroQuery, }; pub use hir_ty::db::{ - AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, DoInferQuery, - FieldTypesQuery, GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, - HirDatabase, HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, - ImplsForTraitQuery, ImplsInCrateQuery, InternAssocTyValueQuery, InternChalkImplQuery, + AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery, + GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase, + HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery, + ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery, InternTypeCtorQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, ValueTyQuery, }; 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 { #[salsa::invoke(RawItems::raw_items_query)] fn raw_items(&self, file_id: HirFileId) -> Arc; - #[salsa::transparent] + #[salsa::invoke(crate_def_map_wait)] fn crate_def_map(&self, krate: CrateId) -> Arc; - #[salsa::invoke(CrateDefMap::compute_crate_def_map_query)] - fn compute_crate_def_map(&self, krate: CrateId) -> Arc; + #[salsa::invoke(CrateDefMap::crate_def_map_query)] + fn crate_def_map_query(&self, krate: CrateId) -> Arc; #[salsa::invoke(StructData::struct_data_query)] fn struct_data(&self, id: StructId) -> Arc; @@ -109,7 +109,7 @@ pub trait DefDatabase: InternDatabase + AstDatabase { fn documentation(&self, def: AttrDefId) -> Option; } -fn crate_def_map(db: &impl DefDatabase, krate: CrateId) -> Arc { - let _p = profile("wait_crate_def_map"); - db.compute_crate_def_map(krate) +fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc { + let _p = profile("crate_def_map:wait"); + db.crate_def_map_query(krate) } 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 { } impl CrateDefMap { - pub(crate) fn compute_crate_def_map_query( - // Note that this doesn't have `+ AstDatabase`! - // This gurantess that `CrateDefMap` is stable across reparses. - db: &impl DefDatabase, - krate: CrateId, - ) -> Arc { - let _p = profile("crate_def_map"); + pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: CrateId) -> Arc { + let _p = profile("crate_def_map_query"); let def_map = { let crate_graph = db.crate_graph(); 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; #[salsa::query_group(HirDatabaseStorage)] #[salsa::requires(salsa::Database)] pub trait HirDatabase: DefDatabase { - #[salsa::transparent] + #[salsa::invoke(infer_wait)] fn infer(&self, def: DefWithBodyId) -> Arc; - #[salsa::invoke(crate::do_infer_query)] - fn do_infer(&self, def: DefWithBodyId) -> Arc; + #[salsa::invoke(crate::infer::infer_query)] + fn infer_query(&self, def: DefWithBodyId) -> Arc; #[salsa::invoke(crate::lower::ty_query)] #[salsa::cycle(crate::lower::ty_recover)] @@ -103,8 +103,8 @@ pub trait HirDatabase: DefDatabase { ) -> Option; } -fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc { - let _p = profile("wait_infer").detail(|| match def { +fn infer_wait(db: &impl HirDatabase, def: DefWithBodyId) -> Arc { + let _p = profile("infer:wait").detail(|| match def { DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(), DefWithBodyId::StaticId(it) => { 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 { db.const_data(it).name.clone().unwrap_or_else(Name::missing).to_string() } }); - db.do_infer(def) + db.infer_query(def) } #[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; mod coerce; /// The entry point of type inference. -pub fn do_infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc { - let _p = profile("infer"); +pub(crate) fn infer_query(db: &impl HirDatabase, def: DefWithBodyId) -> Arc { + let _p = profile("infer_query"); let resolver = def.resolver(db); let mut ctx = InferenceContext::new(db, def, resolver); 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; pub mod method_resolution; mod op; mod lower; -mod infer; +pub(crate) mod infer; pub mod display; pub(crate) mod utils; pub mod db; @@ -57,7 +57,7 @@ use crate::{ use display::HirDisplay; pub use autoderef::autoderef; -pub use infer::{do_infer_query, InferTy, InferenceResult}; +pub use infer::{InferTy, InferenceResult}; pub use lower::CallableDef; pub use lower::{ 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 { self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); self.query(hir::db::ExprScopesQuery).sweep(sweep); - self.query(hir::db::DoInferQuery).sweep(sweep); + self.query(hir::db::InferQueryQuery).sweep(sweep); self.query(hir::db::BodyQuery).sweep(sweep); } @@ -318,7 +318,7 @@ impl RootDatabase { // DefDatabase hir::db::RawItemsQuery - hir::db::ComputeCrateDefMapQuery + hir::db::CrateDefMapQueryQuery hir::db::StructDataQuery hir::db::UnionDataQuery hir::db::EnumDataQuery @@ -350,7 +350,7 @@ impl RootDatabase { hir::db::InternImplQuery // HirDatabase - hir::db::DoInferQuery + hir::db::InferQueryQuery hir::db::TyQuery hir::db::ValueTyQuery hir::db::ImplSelfTyQuery -- cgit v1.2.3