mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #3724
3724: Cleanup memory usage stats r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
402bf53a09
4 changed files with 16 additions and 11 deletions
|
@ -10,15 +10,16 @@ pub use hir_def::db::{
|
||||||
TraitDataQuery, TypeAliasDataQuery, UnionDataQuery,
|
TraitDataQuery, TypeAliasDataQuery, UnionDataQuery,
|
||||||
};
|
};
|
||||||
pub use hir_expand::db::{
|
pub use hir_expand::db::{
|
||||||
AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternMacroQuery, MacroArgQuery, MacroDefQuery,
|
AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery,
|
||||||
MacroExpandQuery, ParseMacroQuery,
|
MacroArgQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery,
|
||||||
};
|
};
|
||||||
pub use hir_ty::db::{
|
pub use hir_ty::db::{
|
||||||
AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery,
|
AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery,
|
||||||
GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase,
|
GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase,
|
||||||
HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery,
|
HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery,
|
||||||
ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery,
|
ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery,
|
||||||
InternTypeCtorQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, ValueTyQuery,
|
InternTypeCtorQuery, InternTypeParamIdQuery, StructDatumQuery, TraitDatumQuery,
|
||||||
|
TraitSolveQuery, TyQuery, ValueTyQuery,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -48,6 +48,7 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
|
||||||
fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>;
|
fn raw_items(&self, file_id: HirFileId) -> Arc<RawItems>;
|
||||||
|
|
||||||
#[salsa::invoke(crate_def_map_wait)]
|
#[salsa::invoke(crate_def_map_wait)]
|
||||||
|
#[salsa::transparent]
|
||||||
fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>;
|
fn crate_def_map(&self, krate: CrateId) -> Arc<CrateDefMap>;
|
||||||
|
|
||||||
#[salsa::invoke(CrateDefMap::crate_def_map_query)]
|
#[salsa::invoke(CrateDefMap::crate_def_map_query)]
|
||||||
|
@ -109,12 +110,6 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
|
||||||
fn documentation(&self, def: AttrDefId) -> Option<Documentation>;
|
fn documentation(&self, def: AttrDefId) -> Option<Documentation>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl<T: DefDatabase> Upcast<dyn AstDatabase> for T {
|
|
||||||
// fn upcast(&self) -> &dyn AstDatabase {
|
|
||||||
// &*self
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
|
fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc<CrateDefMap> {
|
||||||
let _p = profile("crate_def_map:wait");
|
let _p = profile("crate_def_map:wait");
|
||||||
db.crate_def_map_query(krate)
|
db.crate_def_map_query(krate)
|
||||||
|
|
|
@ -22,6 +22,7 @@ use hir_expand::name::Name;
|
||||||
#[salsa::requires(salsa::Database)]
|
#[salsa::requires(salsa::Database)]
|
||||||
pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||||
#[salsa::invoke(infer_wait)]
|
#[salsa::invoke(infer_wait)]
|
||||||
|
#[salsa::transparent]
|
||||||
fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
|
fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::infer::infer_query)]
|
#[salsa::invoke(crate::infer::infer_query)]
|
||||||
|
|
|
@ -311,6 +311,7 @@ impl RootDatabase {
|
||||||
hir::db::MacroDefQuery
|
hir::db::MacroDefQuery
|
||||||
hir::db::ParseMacroQuery
|
hir::db::ParseMacroQuery
|
||||||
hir::db::MacroExpandQuery
|
hir::db::MacroExpandQuery
|
||||||
|
hir::db::InternEagerExpansionQuery
|
||||||
|
|
||||||
// DefDatabase
|
// DefDatabase
|
||||||
hir::db::RawItemsQuery
|
hir::db::RawItemsQuery
|
||||||
|
@ -359,14 +360,21 @@ impl RootDatabase {
|
||||||
hir::db::ImplsInCrateQuery
|
hir::db::ImplsInCrateQuery
|
||||||
hir::db::ImplsForTraitQuery
|
hir::db::ImplsForTraitQuery
|
||||||
hir::db::InternTypeCtorQuery
|
hir::db::InternTypeCtorQuery
|
||||||
|
hir::db::InternTypeParamIdQuery
|
||||||
hir::db::InternChalkImplQuery
|
hir::db::InternChalkImplQuery
|
||||||
hir::db::InternAssocTyValueQuery
|
hir::db::InternAssocTyValueQuery
|
||||||
hir::db::AssociatedTyDataQuery
|
hir::db::AssociatedTyDataQuery
|
||||||
hir::db::AssociatedTyValueQuery
|
|
||||||
hir::db::TraitSolveQuery
|
|
||||||
hir::db::TraitDatumQuery
|
hir::db::TraitDatumQuery
|
||||||
hir::db::StructDatumQuery
|
hir::db::StructDatumQuery
|
||||||
hir::db::ImplDatumQuery
|
hir::db::ImplDatumQuery
|
||||||
|
hir::db::AssociatedTyValueQuery
|
||||||
|
hir::db::TraitSolveQuery
|
||||||
|
|
||||||
|
// SymbolsDatabase
|
||||||
|
crate::symbol_index::FileSymbolsQuery
|
||||||
|
|
||||||
|
// LineIndexDatabase
|
||||||
|
crate::LineIndexQuery
|
||||||
];
|
];
|
||||||
acc.sort_by_key(|it| std::cmp::Reverse(it.1));
|
acc.sort_by_key(|it| std::cmp::Reverse(it.1));
|
||||||
acc
|
acc
|
||||||
|
|
Loading…
Reference in a new issue