Allow specifying additional info on call to profile
This commit is contained in:
@@ -16,6 +16,7 @@ use crate::{
|
||||
Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty,
|
||||
TyDefId, TypeCtor, ValueTyDefId,
|
||||
};
|
||||
use hir_expand::name::Name;
|
||||
|
||||
#[salsa::query_group(HirDatabaseStorage)]
|
||||
#[salsa::requires(salsa::Database)]
|
||||
@@ -111,7 +112,15 @@ pub trait HirDatabase: DefDatabase {
|
||||
}
|
||||
|
||||
fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
|
||||
let _p = profile("wait_infer");
|
||||
let _p = profile("wait_infer").detail(|| match def {
|
||||
DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(),
|
||||
DefWithBodyId::StaticId(it) => {
|
||||
db.static_data(it).name.clone().unwrap_or_else(Name::missing).to_string()
|
||||
}
|
||||
DefWithBodyId::ConstId(it) => {
|
||||
db.const_data(it).name.clone().unwrap_or_else(Name::missing).to_string()
|
||||
}
|
||||
});
|
||||
db.do_infer(def)
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,10 @@ pub(crate) fn trait_solve_query(
|
||||
krate: CrateId,
|
||||
goal: Canonical<InEnvironment<Obligation>>,
|
||||
) -> Option<Solution> {
|
||||
let _p = profile("trait_solve_query");
|
||||
let _p = profile("trait_solve_query").detail(|| match &goal.value.value {
|
||||
Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(),
|
||||
Obligation::Projection(_) => "projection".to_string(),
|
||||
});
|
||||
log::debug!("trait_solve_query({})", goal.value.value.display(db));
|
||||
|
||||
if let Obligation::Projection(pred) = &goal.value.value {
|
||||
|
||||
Reference in New Issue
Block a user