aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-25 18:36:37 +0000
committerGitHub <[email protected]>2020-03-25 18:36:37 +0000
commit402bf53a09a3edbb0ff4c94bf22d94d484f81eb9 (patch)
tree6b60bb49f5b7468cf3165cc74472309e9c6a92b1
parent3d38d4dc9445de783d5efbc72fbdceaa094f23c3 (diff)
parent9f53cec1da6ae9ed8735e28fca09837a0cef7667 (diff)
Merge #3724
3724: Cleanup memory usage stats r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_hir/src/db.rs7
-rw-r--r--crates/ra_hir_def/src/db.rs7
-rw-r--r--crates/ra_hir_ty/src/db.rs1
-rw-r--r--crates/ra_ide_db/src/change.rs12
4 files changed, 16 insertions, 11 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index fcba95091..ec931b34f 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -10,15 +10,16 @@ pub use hir_def::db::{
10 TraitDataQuery, TypeAliasDataQuery, UnionDataQuery, 10 TraitDataQuery, TypeAliasDataQuery, UnionDataQuery,
11}; 11};
12pub use hir_expand::db::{ 12pub use hir_expand::db::{
13 AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternMacroQuery, MacroArgQuery, MacroDefQuery, 13 AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery,
14 MacroExpandQuery, ParseMacroQuery, 14 MacroArgQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery,
15}; 15};
16pub use hir_ty::db::{ 16pub use hir_ty::db::{
17 AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery, 17 AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery,
18 GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase, 18 GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase,
19 HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery, 19 HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery,
20 ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery, 20 ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery,
21 InternTypeCtorQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, ValueTyQuery, 21 InternTypeCtorQuery, InternTypeParamIdQuery, StructDatumQuery, TraitDatumQuery,
22 TraitSolveQuery, TyQuery, ValueTyQuery,
22}; 23};
23 24
24#[test] 25#[test]
diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs
index 7f8c1ea21..5dc7395f5 100644
--- a/crates/ra_hir_def/src/db.rs
+++ b/crates/ra_hir_def/src/db.rs
@@ -48,6 +48,7 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
48 fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>; 48 fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>;
49 49
50 #[salsa::invoke(crate_def_map_wait)] 50 #[salsa::invoke(crate_def_map_wait)]
51 #[salsa::transparent]
51 fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>; 52 fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>;
52 53
53 #[salsa::invoke(CrateDefMap::crate_def_map_query)] 54 #[salsa::invoke(CrateDefMap::crate_def_map_query)]
@@ -109,12 +110,6 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
109 fn documentation(&self, def: AttrDefId) -> Option<Documentation>; 110 fn documentation(&self, def: AttrDefId) -> Option<Documentation>;
110} 111}
111 112
112// impl<T: DefDatabase> Upcast<dyn AstDatabase> for T {
113// fn upcast(&self) -> &dyn AstDatabase {
114// &*self
115// }
116// }
117
118fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> { 113fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
119 let _p = profile("crate_def_map:wait"); 114 let _p = profile("crate_def_map:wait");
120 db.crate_def_map_query(krate) 115 db.crate_def_map_query(krate)
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index 11fc2ac3d..1462b053f 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -22,6 +22,7 @@ use hir_expand::name::Name;
22#[salsa::requires(salsa::Database)] 22#[salsa::requires(salsa::Database)]
23pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> { 23pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
24 #[salsa::invoke(infer_wait)] 24 #[salsa::invoke(infer_wait)]
25 #[salsa::transparent]
25 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; 26 fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
26 27
27 #[salsa::invoke(crate::infer::infer_query)] 28 #[salsa::invoke(crate::infer::infer_query)]
diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs
index 628cf6416..8446ef88e 100644
--- a/crates/ra_ide_db/src/change.rs
+++ b/crates/ra_ide_db/src/change.rs
@@ -311,6 +311,7 @@ impl RootDatabase {
311 hir::db::MacroDefQuery 311 hir::db::MacroDefQuery
312 hir::db::ParseMacroQuery 312 hir::db::ParseMacroQuery
313 hir::db::MacroExpandQuery 313 hir::db::MacroExpandQuery
314 hir::db::InternEagerExpansionQuery
314 315
315 // DefDatabase 316 // DefDatabase
316 hir::db::RawItemsQuery 317 hir::db::RawItemsQuery
@@ -359,14 +360,21 @@ impl RootDatabase {
359 hir::db::ImplsInCrateQuery 360 hir::db::ImplsInCrateQuery
360 hir::db::ImplsForTraitQuery 361 hir::db::ImplsForTraitQuery
361 hir::db::InternTypeCtorQuery 362 hir::db::InternTypeCtorQuery
363 hir::db::InternTypeParamIdQuery
362 hir::db::InternChalkImplQuery 364 hir::db::InternChalkImplQuery
363 hir::db::InternAssocTyValueQuery 365 hir::db::InternAssocTyValueQuery
364 hir::db::AssociatedTyDataQuery 366 hir::db::AssociatedTyDataQuery
365 hir::db::AssociatedTyValueQuery
366 hir::db::TraitSolveQuery
367 hir::db::TraitDatumQuery 367 hir::db::TraitDatumQuery
368 hir::db::StructDatumQuery 368 hir::db::StructDatumQuery
369 hir::db::ImplDatumQuery 369 hir::db::ImplDatumQuery
370 hir::db::AssociatedTyValueQuery
371 hir::db::TraitSolveQuery
372
373 // SymbolsDatabase
374 crate::symbol_index::FileSymbolsQuery
375
376 // LineIndexDatabase
377 crate::LineIndexQuery
370 ]; 378 ];
371 acc.sort_by_key(|it| std::cmp::Reverse(it.1)); 379 acc.sort_by_key(|it| std::cmp::Reverse(it.1));
372 acc 380 acc