mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-16 01:38:13 +00:00
Merge #8515
8515: internal: Profile trait solving for all invocations r=flodiebold a=SomeoneToIgnore Follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/8514#issuecomment-819610492 Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
commit
e131bfc747
3 changed files with 20 additions and 6 deletions
|
@ -85,10 +85,7 @@ fn deref_by_trait(
|
|||
environment: ty.environment.clone(),
|
||||
},
|
||||
};
|
||||
if {
|
||||
let _p = profile::span("db.trait_solve");
|
||||
db.trait_solve(krate, implements_goal).is_none()
|
||||
} {
|
||||
if db.trait_solve(krate, implements_goal).is_none() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,13 +128,21 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
|||
id: chalk_db::AssociatedTyValueId,
|
||||
) -> Arc<chalk_db::AssociatedTyValue>;
|
||||
|
||||
#[salsa::invoke(crate::traits::trait_solve_query)]
|
||||
#[salsa::invoke(trait_solve_wait)]
|
||||
#[salsa::transparent]
|
||||
fn trait_solve(
|
||||
&self,
|
||||
krate: CrateId,
|
||||
goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
|
||||
) -> Option<crate::Solution>;
|
||||
|
||||
#[salsa::invoke(crate::traits::trait_solve_query)]
|
||||
fn trait_solve_query(
|
||||
&self,
|
||||
krate: CrateId,
|
||||
goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
|
||||
) -> Option<crate::Solution>;
|
||||
|
||||
#[salsa::invoke(chalk_db::program_clauses_for_chalk_env_query)]
|
||||
fn program_clauses_for_chalk_env(
|
||||
&self,
|
||||
|
@ -156,6 +164,15 @@ fn infer_wait(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult>
|
|||
db.infer_query(def)
|
||||
}
|
||||
|
||||
fn trait_solve_wait(
|
||||
db: &dyn HirDatabase,
|
||||
krate: CrateId,
|
||||
goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
|
||||
) -> Option<crate::Solution> {
|
||||
let _p = profile::span("trait_solve::wait");
|
||||
db.trait_solve_query(krate, goal)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hir_database_is_object_safe() {
|
||||
fn _assert_object_safe(_: &dyn HirDatabase) {}
|
||||
|
|
|
@ -201,7 +201,7 @@ impl RootDatabase {
|
|||
hir::db::InternImplTraitIdQuery
|
||||
hir::db::InternClosureQuery
|
||||
hir::db::AssociatedTyValueQuery
|
||||
hir::db::TraitSolveQuery
|
||||
hir::db::TraitSolveQueryQuery
|
||||
|
||||
// SymbolsDatabase
|
||||
crate::symbol_index::FileSymbolsQuery
|
||||
|
|
Loading…
Reference in a new issue