diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index f5ffd64fa7..0af4a28683 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -1,11 +1,11 @@ //! FIXME: write short doc here pub use hir_def::db::{ - BodyQuery, BodyWithSourceMapQuery, ConstDataQuery, CrateDefMapQuery, CrateLangItemsQuery, - DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery, ExprScopesQuery, - FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternDatabase, InternDatabaseStorage, - LangItemQuery, ModuleLangItemsQuery, RawItemsQuery, StaticDataQuery, StructDataQuery, - TraitDataQuery, TypeAliasDataQuery, + BodyQuery, BodyWithSourceMapQuery, ComputeCrateDefMapQuery, ConstDataQuery, + CrateLangItemsQuery, DefDatabase, DefDatabaseStorage, DocumentationQuery, EnumDataQuery, + ExprScopesQuery, FunctionDataQuery, GenericParamsQuery, ImplDataQuery, InternDatabase, + InternDatabaseStorage, LangItemQuery, ModuleLangItemsQuery, RawItemsQuery, StaticDataQuery, + StructDataQuery, TraitDataQuery, TypeAliasDataQuery, }; pub use hir_expand::db::{ AstDatabase, AstDatabaseStorage, AstIdMapQuery, MacroArgQuery, MacroDefQuery, MacroExpandQuery, diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs index c55fd41110..da273eb115 100644 --- a/crates/ra_hir_def/src/db.rs +++ b/crates/ra_hir_def/src/db.rs @@ -3,6 +3,7 @@ use std::sync::Arc; use hir_expand::{db::AstDatabase, HirFileId}; use ra_db::{salsa, CrateId, SourceDatabase}; +use ra_prof::profile; use ra_syntax::SmolStr; use crate::{ @@ -46,9 +47,12 @@ pub trait DefDatabase: InternDatabase + AstDatabase { #[salsa::invoke(RawItems::raw_items_query)] fn raw_items(&self, file_id: HirFileId) -> Arc; - #[salsa::invoke(CrateDefMap::crate_def_map_query)] + #[salsa::transparent] 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(StructData::struct_data_query)] fn struct_data(&self, id: StructId) -> Arc; #[salsa::invoke(StructData::union_data_query)] @@ -104,3 +108,8 @@ pub trait DefDatabase: InternDatabase + AstDatabase { #[salsa::invoke(Documentation::documentation_query)] fn documentation(&self, def: AttrDefId) -> Option; } + +fn crate_def_map(db: &impl DefDatabase, krate: CrateId) -> Arc { + let _p = profile("crate_def_map"); + db.compute_crate_def_map(krate) +} diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 5d4ca73a39..4d210eab12 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs @@ -172,13 +172,13 @@ pub struct ModuleData { } impl CrateDefMap { - pub(crate) fn crate_def_map_query( + 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_query"); + let _p = profile("compute_crate_def_map"); let def_map = { let crate_graph = db.crate_graph(); let edition = crate_graph.edition(krate); diff --git a/crates/ra_ide/src/change.rs b/crates/ra_ide/src/change.rs index 387a9cafb6..4585bf522d 100644 --- a/crates/ra_ide/src/change.rs +++ b/crates/ra_ide/src/change.rs @@ -309,7 +309,7 @@ impl RootDatabase { hir::db::EnumDataQuery hir::db::TraitDataQuery hir::db::RawItemsQuery - hir::db::CrateDefMapQuery + hir::db::ComputeCrateDefMapQuery hir::db::GenericParamsQuery hir::db::FunctionDataQuery hir::db::TypeAliasDataQuery