Skip to content

Move and expand the big rustc_query_impl macro into a physical query_impl.rs#153760

Open
Zalathar wants to merge 2 commits intorust-lang:mainfrom
Zalathar:query-impl
Open

Move and expand the big rustc_query_impl macro into a physical query_impl.rs#153760
Zalathar wants to merge 2 commits intorust-lang:mainfrom
Zalathar:query-impl

Conversation

@Zalathar
Copy link
Member

While looking through #153588, I came up with a related but different change that I think resolves a lot of tension in the current module arrangement.

The core idea is that if we both define and expand the big macro in the same physical module rustc_query_impl::query_impl, then we no longer need to worry about where mod query_impl should be declared, or where its imports should go, because those questions now have simple and obvious answers.

The second commit follows up with some more changes inspired by #153588. Those particular follow-ups are not essential to the main idea of this PR.

r? nnethercote

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

cc @Zoxc @zetanumbers on this structural change to rustc_query_impl.

The idea of splitting off the big macro has some overlap with the ideas in #151977, but I think the key insight of this PR is that there's a lot of benefit from defining and expanding the macro in the same module.

@rust-log-analyzer

This comment has been minimized.

Moving the macro and its expansion into the same physical file resolves a lot
of tension in the current module arrangement.

Code in the macro is now free to use plain imports in the same file, and there
is no longer any question of whether `mod query_impl` should be declared inside
the macro, or surrounding a separate expansion site.
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 12, 2026

☔ The latest upstream changes (presumably #153770) made this pull request unmergeable. Please resolve the merge conflicts.

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.

4 participants