Merge #8514
8514: Add more profiling spans into type inference r=matklad a=SomeoneToIgnore Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8503 I've added a minimal set of spans to remove `???` and showcase the underlying issue: <img width="1552" alt="image" src="https://user-images.githubusercontent.com/2690773/114722983-f2181900-9d42-11eb-821d-9e93ded5f81f.png"> `db.trait_solve` reliably produces the same timings for the same input in the same place for me, despite supposedly being cached by Salsa. In my perception, this is a bit odd, so I've decided to stop at this point and discuss it with people with better knowledge on the topic. Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
commit
678af41065
@ -36,6 +36,7 @@ pub(crate) fn deref(
|
||||
krate: CrateId,
|
||||
ty: InEnvironment<&Canonical<Ty>>,
|
||||
) -> Option<Canonical<Ty>> {
|
||||
let _p = profile::span("deref");
|
||||
if let Some(derefed) = builtin_deref(&ty.goal.value) {
|
||||
Some(Canonical { value: derefed, binders: ty.goal.binders.clone() })
|
||||
} else {
|
||||
@ -56,6 +57,7 @@ fn deref_by_trait(
|
||||
krate: CrateId,
|
||||
ty: InEnvironment<&Canonical<Ty>>,
|
||||
) -> Option<Canonical<Ty>> {
|
||||
let _p = profile::span("deref_by_trait");
|
||||
let deref_trait = match db.lang_item(krate, "deref".into())? {
|
||||
LangItemTarget::TraitId(it) => it,
|
||||
_ => return None,
|
||||
@ -83,7 +85,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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user