From b33b843f408fe73bde920c087de0622f46e853e5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 6 Mar 2020 17:23:08 +0100 Subject: Allow specifying additional info on call to profile --- crates/ra_hir_ty/src/db.rs | 11 ++++++++++- crates/ra_hir_ty/src/traits.rs | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_ty') diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs index c43619d1c..f79faa84d 100644 --- a/crates/ra_hir_ty/src/db.rs +++ b/crates/ra_hir_ty/src/db.rs @@ -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 { - 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) } diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index bc6ee2600..bdf23ac02 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs @@ -221,7 +221,10 @@ pub(crate) fn trait_solve_query( krate: CrateId, goal: Canonical>, ) -> Option { - 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 { -- cgit v1.2.3