Description
In the Value
impl for FnSig
, we compare against the name of the query in the query stack frame. This is suboptimal because it will break if the query name is changed. To guard against this, we should instead do a comparison against the DepNode
(an enum of all queries). This isn't possible yet because the DepKind
isn't part of the query frame but it should be. We do have it available where we create the QueryStackFrame
.
We can then replace the name: &'static str
with a dep_kind: DepKind
, but this does require us to add a generic parameter for the dep kind to QueryStackFrame
and all of the places its used. We can also use type aliases in rustc_middle
to make this not too bad. (Look at the existing types using DepKind
to get an example of how to do it). With that we may need a fn as_str(&self) -> &str
function (or Debug impl) on DepKind
in places where the name is printed which should be easy to add with stringify!()
where it's generated. This way we could get rid of the string comparison here and maybe also improve things in other places.
Originally posted by @Nilstrieb in #105162 (comment)