aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-06 16:23:08 +0000
committerAleksey Kladov <[email protected]>2020-03-06 16:36:51 +0000
commitb33b843f408fe73bde920c087de0622f46e853e5 (patch)
treed6b5eea44ab7bb61cc3b66e622ffb0031b54d777 /crates/ra_hir_ty
parent59f91f2f9ba4cb6fa86fccb8a427cb9af2ecd192 (diff)
Allow specifying additional info on call to profile
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/db.rs11
-rw-r--r--crates/ra_hir_ty/src/traits.rs5
2 files changed, 14 insertions, 2 deletions
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::{
16 Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty, 16 Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty,
17 TyDefId, TypeCtor, ValueTyDefId, 17 TyDefId, TypeCtor, ValueTyDefId,
18}; 18};
19use hir_expand::name::Name;
19 20
20#[salsa::query_group(HirDatabaseStorage)] 21#[salsa::query_group(HirDatabaseStorage)]
21#[salsa::requires(salsa::Database)] 22#[salsa::requires(salsa::Database)]
@@ -111,7 +112,15 @@ pub trait HirDatabase: DefDatabase {
111} 112}
112 113
113fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> { 114fn infer(db: &impl HirDatabase, def: DefWithBodyId) -> Arc<InferenceResult> {
114 let _p = profile("wait_infer"); 115 let _p = profile("wait_infer").detail(|| match def {
116 DefWithBodyId::FunctionId(it) => db.function_data(it).name.to_string(),
117 DefWithBodyId::StaticId(it) => {
118 db.static_data(it).name.clone().unwrap_or_else(Name::missing).to_string()
119 }
120 DefWithBodyId::ConstId(it) => {
121 db.const_data(it).name.clone().unwrap_or_else(Name::missing).to_string()
122 }
123 });
115 db.do_infer(def) 124 db.do_infer(def)
116} 125}
117 126
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(
221 krate: CrateId, 221 krate: CrateId,
222 goal: Canonical<InEnvironment<Obligation>>, 222 goal: Canonical<InEnvironment<Obligation>>,
223) -> Option<Solution> { 223) -> Option<Solution> {
224 let _p = profile("trait_solve_query"); 224 let _p = profile("trait_solve_query").detail(|| match &goal.value.value {
225 Obligation::Trait(it) => db.trait_data(it.trait_).name.to_string(),
226 Obligation::Projection(_) => "projection".to_string(),
227 });
225 log::debug!("trait_solve_query({})", goal.value.value.display(db)); 228 log::debug!("trait_solve_query({})", goal.value.value.display(db));
226 229
227 if let Obligation::Projection(pred) = &goal.value.value { 230 if let Obligation::Projection(pred) = &goal.value.value {