mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +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
@ -85,10 +85,7 @@ fn deref_by_trait(
|
|||||||
environment: ty.environment.clone(),
|
environment: ty.environment.clone(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if {
|
if db.trait_solve(krate, implements_goal).is_none() {
|
||||||
let _p = profile::span("db.trait_solve");
|
|
||||||
db.trait_solve(krate, implements_goal).is_none()
|
|
||||||
} {
|
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,13 +128,21 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
|||||||
id: chalk_db::AssociatedTyValueId,
|
id: chalk_db::AssociatedTyValueId,
|
||||||
) -> Arc<chalk_db::AssociatedTyValue>;
|
) -> Arc<chalk_db::AssociatedTyValue>;
|
||||||
|
|
||||||
#[salsa::invoke(crate::traits::trait_solve_query)]
|
#[salsa::invoke(trait_solve_wait)]
|
||||||
|
#[salsa::transparent]
|
||||||
fn trait_solve(
|
fn trait_solve(
|
||||||
&self,
|
&self,
|
||||||
krate: CrateId,
|
krate: CrateId,
|
||||||
goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
|
goal: crate::Canonical<crate::InEnvironment<crate::DomainGoal>>,
|
||||||
) -> Option<crate::Solution>;
|
) -> 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)]
|
#[salsa::invoke(chalk_db::program_clauses_for_chalk_env_query)]
|
||||||
fn program_clauses_for_chalk_env(
|
fn program_clauses_for_chalk_env(
|
||||||
&self,
|
&self,
|
||||||
@ -156,6 +164,15 @@ fn infer_wait(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult>
|
|||||||
db.infer_query(def)
|
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]
|
#[test]
|
||||||
fn hir_database_is_object_safe() {
|
fn hir_database_is_object_safe() {
|
||||||
fn _assert_object_safe(_: &dyn HirDatabase) {}
|
fn _assert_object_safe(_: &dyn HirDatabase) {}
|
||||||
|
@ -201,7 +201,7 @@ impl RootDatabase {
|
|||||||
hir::db::InternImplTraitIdQuery
|
hir::db::InternImplTraitIdQuery
|
||||||
hir::db::InternClosureQuery
|
hir::db::InternClosureQuery
|
||||||
hir::db::AssociatedTyValueQuery
|
hir::db::AssociatedTyValueQuery
|
||||||
hir::db::TraitSolveQuery
|
hir::db::TraitSolveQueryQuery
|
||||||
|
|
||||||
// SymbolsDatabase
|
// SymbolsDatabase
|
||||||
crate::symbol_index::FileSymbolsQuery
|
crate::symbol_index::FileSymbolsQuery
|
||||||
|
Loading…
x
Reference in New Issue
Block a user