define_queries! module tweaks#153588
Conversation
|
|
|
@Zalathar: not sure if you'll like these, but I figured it's worth a try. |
b045589 to
ca85c9b
Compare
This comment has been minimized.
This comment has been minimized.
ca85c9b to
0b115aa
Compare
This comment has been minimized.
This comment has been minimized.
|
I rebased. |
|
I was a little uneasy about defining other items in the same module as per-query submodules, but #153685 will end up removing all of those other items except |
This comment has been minimized.
This comment has been minimized.
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.
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.
0b115aa to
5d0eea5
Compare
|
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. |
|
I have rebased over #153685, see what you think now. |
|
Something I found while playing around with this branch (and also on That's not directly actionable, but it does make me want to find a style of imports that is less vulnerable to that failure mode. It also makes me wonder whether the common imports needed by the |
|
While thinking about the implications of my previous comment, I came up with the idea for #153760, which I think is a promising alternative to some of the changes in this PR. |
|
Superseded by #153760. |
Move and expand the big `rustc_query_impl` macro into a physical `query_impl.rs` While looking through rust-lang#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 rust-lang#153588. Those particular follow-ups are not essential to the main idea of this PR. r? nnethercote
Move and expand the big `rustc_query_impl` macro into a physical `query_impl.rs` While looking through rust-lang#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 rust-lang#153588. Those particular follow-ups are not essential to the main idea of this PR. r? nnethercote
Minor module structure tweaks, trying to make
define_queries!nicer and more likedefine_callbacks!. Details in individual commits.r? @Zalathar