From d1fc9d727be6f39d5511cf4c5125b40489dfd6be Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 14 Apr 2021 15:52:56 +0300 Subject: Add a missing span --- crates/hir_ty/src/autoderef.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs index 71bc436e6..7afa2d5ce 100644 --- a/crates/hir_ty/src/autoderef.rs +++ b/crates/hir_ty/src/autoderef.rs @@ -24,8 +24,10 @@ pub fn autoderef<'a>( krate: Option, ty: InEnvironment>, ) -> impl Iterator> + 'a { + let _p = profile::span("autoderef"); let InEnvironment { goal: ty, environment } = ty; successors(Some(ty), move |ty| { + let _p = profile::span("autoderef.step"); deref(db, krate?, InEnvironment { goal: ty, environment: environment.clone() }) }) .take(AUTODEREF_RECURSION_LIMIT) -- cgit v1.2.3 From 3390e738164b0c112a028f3967bf13915023e167 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 14 Apr 2021 16:59:08 +0300 Subject: We need to go deeper --- crates/hir_ty/src/autoderef.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs index 7afa2d5ce..eae0ad949 100644 --- a/crates/hir_ty/src/autoderef.rs +++ b/crates/hir_ty/src/autoderef.rs @@ -58,6 +58,7 @@ fn deref_by_trait( krate: CrateId, ty: InEnvironment<&Canonical>, ) -> Option> { + let _p = profile::span("deref_by_trait"); let deref_trait = match db.lang_item(krate, "deref".into())? { LangItemTarget::TraitId(it) => it, _ => return None, @@ -85,7 +86,10 @@ fn deref_by_trait( environment: ty.environment.clone(), }, }; - if db.trait_solve(krate, implements_goal).is_none() { + if { + let _p = profile::span("db.trait_solve"); + db.trait_solve(krate, implements_goal).is_none() + } { return None; } -- cgit v1.2.3 From 75a2605361e497cdb6f8c8a4056a6ecd1e35ad68 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Wed, 14 Apr 2021 17:15:37 +0300 Subject: Better places for spans --- crates/hir_ty/src/autoderef.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/autoderef.rs b/crates/hir_ty/src/autoderef.rs index eae0ad949..6d2cf4619 100644 --- a/crates/hir_ty/src/autoderef.rs +++ b/crates/hir_ty/src/autoderef.rs @@ -24,10 +24,8 @@ pub fn autoderef<'a>( krate: Option, ty: InEnvironment>, ) -> impl Iterator> + 'a { - let _p = profile::span("autoderef"); let InEnvironment { goal: ty, environment } = ty; successors(Some(ty), move |ty| { - let _p = profile::span("autoderef.step"); deref(db, krate?, InEnvironment { goal: ty, environment: environment.clone() }) }) .take(AUTODEREF_RECURSION_LIMIT) @@ -38,6 +36,7 @@ pub(crate) fn deref( krate: CrateId, ty: InEnvironment<&Canonical>, ) -> Option> { + let _p = profile::span("deref"); if let Some(derefed) = builtin_deref(&ty.goal.value) { Some(Canonical { value: derefed, binders: ty.goal.binders.clone() }) } else { -- cgit v1.2.3