Open
Conversation
This use item lets `rustc_query_impl` use `queries::foo` to refer to things from `rustc_middle`, which is confusing, especially within `define_queries!`. This commit removes it, requiring more explicit qualification of imported things. It also removes some unnecessary leading `::` qualifiers from `rustc_middle` mentions for consistency, conciseness, and to spare the poor reader's eyes.
`define_queries!` currently outputs some things (including one `mod $name` per query) into a module `query_impl`, and some things into the crate root. This commit moves the latter things into `query_impl`. This is (a) nicer, and (b) more closely matches what `define_callbacks!` does.
Collaborator
|
|
Contributor
Author
|
@Zalathar: not sure if you'll like these, but I figured it's worth a try. |
Zalathar
reviewed
Mar 9, 2026
| non_queries { $($_:tt)* } | ||
| ) => { | ||
| pub(crate) mod query_impl { $(pub(crate) mod $name { | ||
| $(pub(crate) mod $name { |
Member
There was a problem hiding this comment.
If we leave behind a comment mentioning the module name, that gives us most of the readability/searchability benefits of declaring the module inside the macro, while still improving consistency with rustc_middle and avoiding extra nesting.
// This macro expects to be expanded into `mod query_impl` in the crate root.
Contributor
Author
There was a problem hiding this comment.
Good suggestion. I've added this comment.
This: - reduces the amount of stuff inside `define_queries!` - makes `define_queries!` look more like `define_callbacks!` Also, I want to improve the formatting of `define_queries!` and this will avoid one level of indentation.
b045589 to
ca85c9b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Minor module structure tweaks, trying to make
define_queries!nicer and more likedefine_callbacks!. Details in individual commits.r? @Zalathar