Skip to content

Remove TaggedQueryKey::def_kind#153999

Open
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:rem-TaggedQueryKey-def_kind-uses
Open

Remove TaggedQueryKey::def_kind#153999
Zoxc wants to merge 1 commit intorust-lang:mainfrom
Zoxc:rem-TaggedQueryKey-def_kind-uses

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Mar 17, 2026

This removes TaggedQueryKey::def_kind by accessing the relevant query keys directly.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2026

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, query-system
  • compiler, query-system expanded to 69 candidates
  • Random selection from 14 candidates

@Zoxc
Copy link
Contributor Author

Zoxc commented Mar 17, 2026

cc @Zalathar

let is_all_def_kind = |def_kind| {
stack.iter().all(|entry| match entry.node.tagged_key {
TaggedQueryKey::type_of(def_id)
| TaggedQueryKey::explicit_implied_predicates_of(def_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this condition contain the type_of and explicit_implied_predicates_of queries specifically?
The previous logic didn't contain any specific queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the queries which are involved in simple TyAlias / TraitAlias cycles (in our tests at least).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment and probably a panic if we reach this code with any other TaggedQueryKey.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the surrounding function is called to produce a diagnostic for any query cycle, and this particular snippet is doing a best-effort check for certain situations that would let us add more specific information to that diagnostic.

So a panic here seems inappropriate.

@rust-bors

This comment has been minimized.

@Zoxc Zoxc force-pushed the rem-TaggedQueryKey-def_kind-uses branch from 0838a5f to 6308ab9 Compare March 19, 2026 22:21
@rustbot
Copy link
Collaborator

rustbot commented Mar 19, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants