Skip to content

Conversation

@Zalathar
Copy link
Member


This is another round of renaming for some subtle types and traits used by the query system, to hopefully make them easier to understand.

Key renames:

  • struct DynamicQueryQueryVTable (the actual vtable-like structure)
  • struct DynamicQueriesPerQueryVTables (holds a vtable for each query)
  • trait QueryConfigQueryDispatcher
    • (used by generic functions in rustc_query_system to interact with query vtables)
  • struct DynamicConfigSemiDynamicQueryDispatcher
    • (implements QueryDispatcher by combining a vtable with some compile-time boolean flags for improved perf)
  • trait QueryConfigRestoredUnerasedQueryDispatcher
    • (provides a QueryDispatcher while also remembering the query's unerased value type; allows some per-query code to be moved out of macros and into generic functions)

This was trickier than DepKindVTable, because there are more types and traits involved, and it's harder to come up with distinctive and useful names for all of them.

There should be no change to compiler behaviour.

r? Kivooeo (or compiler)

@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 Jan 26, 2026
@Zalathar
Copy link
Member Author

Zalathar commented Jan 27, 2026

As a follow-up PR, I might try getting rid of QueryConfigRestored/QueryDispatcherUnerased entirely, and just passing a dispatcher plus an unerase function.

That would sidestep the need to name and document the trait.

EDIT: This turns out to be a bit tricky; I would want to land a few other simplifications before trying again.

@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 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.

Copy link
Member

@Kivooeo Kivooeo left a comment

Choose a reason for hiding this comment

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

looks good, thanks!

View changes since this review

@Kivooeo
Copy link
Member

Kivooeo commented Jan 27, 2026

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 27, 2026

📌 Commit 2c9175d has been approved by Kivooeo

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 27, 2026
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 27, 2026
compiler: Rename several types/traits for per-query vtables

- Follow-up to rust-lang#151577
---

This is another round of renaming for some subtle types and traits used by the query system, to hopefully make them easier to understand.

Key renames:
- struct `DynamicQuery` → `QueryVTable` (the actual vtable-like structure)
- struct `DynamicQueries` → `PerQueryVTables` (holds a vtable for each query)
- trait `QueryConfig` → `QueryDispatcher`
  - (used by generic functions in `rustc_query_system` to interact with query vtables)
- struct `DynamicConfig` → `SemiDynamicQueryDispatcher`
  - (implements `QueryDispatcher` by combining a vtable with some compile-time boolean flags for improved perf)
- trait `QueryConfigRestored` → `UnerasedQueryDispatcher`
  - (provides a `QueryDispatcher` while also remembering the query's unerased value type; allows some per-query code to be moved out of macros and into generic functions)

This was trickier than `DepKindVTable`, because there are more types and traits involved, and it's harder to come up with distinctive and useful names for all of them.

There should be no change to compiler behaviour.

r? Kivooeo (or compiler)
rust-bors bot pushed a commit that referenced this pull request Jan 27, 2026
Rollup of 6 pull requests

Successful merges:

 - #151751 (`rust-analyzer` subtree update)
 - #150893 (offload: move (un)register lib into global_ctors)
 - #151013 (Add some clarifications and fixes for fmt syntax)
 - #151666 (compiler: Rename several types/traits for per-query vtables)
 - #151738 (Add `extern crate core` to diagnostic tests)
 - #151759 (Update `browser-ui-test` version to `0.23.3`)
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

3 participants