Use DepKind
instead of &'static str
in QueryStackFrame
#105168
Labels
A-query-system
Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
In the
Value
impl forFnSig
, 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 theDepNode
(an enum of all queries). This isn't possible yet because theDepKind
isn't part of the query frame but it should be. We do have it available where we create theQueryStackFrame
.We can then replace the
name: &'static str
with adep_kind: DepKind
, but this does require us to add a generic parameter for the dep kind toQueryStackFrame
and all of the places its used. We can also use type aliases inrustc_middle
to make this not too bad. (Look at the existing types usingDepKind
to get an example of how to do it). With that we may need afn as_str(&self) -> &str
function (or Debug impl) onDepKind
in places where the name is printed which should be easy to add withstringify!()
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)
The text was updated successfully, but these errors were encountered: