Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Rejig rustc_with_all_queries! - #153161

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries
Mar 2, 2026
Merged

Rejig rustc_with_all_queries!#153161
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
nnethercote:rejig-rustc_with_all_queries

Conversation

@nnethercote

@nnethercotennethercote commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

View all comments

There are three things relating to rustc_with_all_queries! that have been bugging me.

  • rustc_with_all_queries!'s ability to receive extra_fake_queries lines like [] fn Null(()) -> (), where the only real thing is the Null, and everything is just pretending to be a normal query, ugh.
  • make_dep_kind_array!: a macro produced by one macro (define_dep_nodes!) and used by another macro (define_queries!) in another crate, ugh.
  • The _dep_kind_vtable_ctors module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by make_dep_kind_array!, ugh.

By making some adjustments to how rustc_with_all_queries! works, all three of these things are eliminated.

r? @Zalathar

@rustbot

Copy link
Copy Markdown
Collaborator

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbotrustbot 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 Feb 27, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

@Zalathar: I find it hard to predict where our opinions will align on cleanups, but I figure I'll just keep throwing stuff against the wall to see what sticks.

A couple of things I'm uncertain about this one:

  • I've used the term "non-queries" for Null, Red, etc. Not sure that's the best. "Fake" queries, maybe?
  • As per the "njn:" comment, I'm not sure if the proc macro is the best place to embed the list of non-queries.

I'm interested to hear what you think, thanks.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

At first this didn't jump out to me as a big improvement, but after pondering it some more I think it's probably a good direction.

The part I really like is being able to get rid of $extra_fake_queries from rustc_with_all_queries!.

Having to explicitly ignore non_queries in all of the other callback macros is a bit unfortunate, but I think it's a good tradeoff, because it's just a tiny bit of boilerplate that is easily ignored.

I don't have great suggestions for what to call the non-query dep kinds. Some possibilities that come to mind are non_query_dep_kinds or special_dep_kinds, which are perhaps a little bit more self-describing when seen in contexts that don't care about things that aren't queries.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 536063f to a295046CompareMarch 1, 2026 10:59
@rustbot

This comment has been minimized.

@rust-bors

This comment has been minimized.

@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from a295046 to 92684c9CompareMarch 1, 2026 22:06
@rustbot

Copy link
Copy Markdown
Collaborator

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.

@nnethercote

Copy link
Copy Markdown
ContributorAuthor

Comments addressed, should be ready for re-review.

Comment threadcompiler/rustc_macros/src/query.rs Outdated
Comment threadcompiler/rustc_middle/src/dep_graph/dep_node.rs Outdated
Comment threadcompiler/rustc_middle/src/queries.rs
Comment threadcompiler/rustc_query_impl/src/plumbing.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
Comment threadcompiler/rustc_query_impl/src/dep_kind_vtables.rs Outdated
@Zalathar

Copy link
Copy Markdown
Member

Thanks, r=me after resolving and/or rejecting each of the nits.

`rustc_with_all_queries` currently provides information about all
queries. Also, a caller can provide an ad hoc list of extra non-queries.
This is used by `define_queries` for non-query dep kinds: `Null`, `Red`,
etc. This is pretty hacky.
This commit changes `rustc_with_all_queries` so that the non-queries
information is available to all callers. (Some callers ignore the
non-query information.) This is done by adding `non_query` entries to
the primary list of queries in `rustc_queries!`.
Currently `define_dep_nodes` produces a macro `make_dep_kind_array` that
encodes the names of non-queries followed by queries. This macro is used
by `make_dep_kind_vtables` to make the full array of vtables, by
referring to vtable constructor functions that are put into `mod
_dep_kind_vtable_ctors`. Pretty weird!
This commit takes advantage of the previous commit's changes to
`rustc_with_all_queries`, which makes both query and non-query
information available. A new call to `rustc_with_all_queries` is used to
construct the vtable array. (This moves some dep_kind_vtable code from
`plumbing.rs` to `dep_kind_vtables.rs`, which is good.) It's
straightforward now with iterator chaining, and `mod
_dep_kind_vtable_ctors` is no longer needed.
@nnethercote
nnethercoteforce-pushed the rejig-rustc_with_all_queries branch from 92684c9 to 40b2274CompareMarch 2, 2026 05:20
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

I addressed all the nits. Let's do a perf run to be safe.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (dc13f8f): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.6%[2.4%, 4.8%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-7.5%[-7.5%, -7.5%]1
Improvements ✅
(secondary)
--0
All ❌✅ (primary)-0.1%[-7.5%, 4.8%]3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.149s -> 477.903s (-0.47%)
Artifact size: 396.96 MiB -> 396.96 MiB (-0.00%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 2, 2026
@nnethercote

Copy link
Copy Markdown
ContributorAuthor

No perf effects.

@bors r=Zalathar rollup=maybe

@rust-bors

rust-borsBot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 40b2274 has been approved by Zalathar

It is now in the queue for this repository.

@rust-borsrust-borsBot 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 Mar 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153161 (Rejig `rustc_with_all_queries!`)
- #152164 (Lint unused features)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 9 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 2, 2026
…ueries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 11 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #149328 (Add `String<A>` type with custom allocator parameter)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
rust-borsBot pushed a commit that referenced this pull request Mar 2, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- #153153 (add tests for thumb interworking)
- #151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- #151962 (Fix next-solver ICE on PointeeSized goals)
- #153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- #153161 (Rejig `rustc_with_all_queries!`)
- #153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- #153273 (vec/mod.rs: add missing period in "ie." in docs)
- #153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- #153293 (library: std: process: skip tests on Hermit)
- #153301 (Do not ping kobzol on rustc-dev-guide changes)
@rust-bors
rust-borsBot merged commit 34fd06e into rust-lang:mainMar 2, 2026
12 checks passed
@rustbotrustbot added this to the 1.96.0 milestone Mar 2, 2026
rust-timer added a commit that referenced this pull request Mar 2, 2026
Rollup merge of #153161 - nnethercote:rejig-rustc_with_all_queries, r=Zalathar
Rejig `rustc_with_all_queries!`
There are three things relating to `rustc_with_all_queries!` that have been bugging me.
- `rustc_with_all_queries!`'s ability to receive `extra_fake_queries` lines like `[] fn Null(()) -> (),` where the only real thing is the `Null`, and everything is just pretending to be a normal query, ugh.
- `make_dep_kind_array!`: a macro produced by one macro (`define_dep_nodes!`) and used by another macro (`define_queries!`) in another crate, ugh.
- The `_dep_kind_vtable_ctors` module, which is a special module with no actual code that serves just a way of collecting vtable constructors from two different places so they can be referred to by `make_dep_kind_array!`, ugh.
By making some adjustments to how `rustc_with_all_queries!` works, all three of these things are eliminated.
r? @Zalathar
@nnethercote
nnethercote deleted the rejig-rustc_with_all_queries branch March 3, 2026 01:10
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 2168ca5

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (2168ca5): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.0%[0.0%, 0.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-0.1%[-0.1%, -0.1%]1
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
3.4%[3.1%, 3.6%]2
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-9.6%[-9.6%, -9.6%]1
Improvements ✅
(secondary)
-2.7%[-4.3%, -1.1%]2
All ❌✅ (primary)-1.0%[-9.6%, 3.6%]3

Cycles

Results (secondary 5.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
5.6%[4.5%, 6.8%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.113s -> 477.631s (-0.52%)
Artifact size: 396.96 MiB -> 394.94 MiB (-0.51%)

//-----------------------------------------------------------------------------

/// We use this for most things when incr. comp. is turned off.
non_query Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non_query seems quite odd to me. I'd probably prefer just dep_kind.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#153153 (add tests for thumb interworking)
- rust-lang/rust#151780 (Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`)
- rust-lang/rust#151962 (Fix next-solver ICE on PointeeSized goals)
- rust-lang/rust#153015 (core: make atomic primitives type aliases of `Atomic<T>`)
- rust-lang/rust#153161 (Rejig `rustc_with_all_queries!`)
- rust-lang/rust#153191 ( don't emit `unused_results` lint for tuples of "trivial" types )
- rust-lang/rust#153273 (vec/mod.rs: add missing period in "ie." in docs)
- rust-lang/rust#153292 (tests: codegen-llvm: vec-calloc: do not require the uwtable attribute)
- rust-lang/rust#153293 (library: std: process: skip tests on Hermit)
- rust-lang/rust#153301 (Do not ping kobzol on rustc-dev-guide changes)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

6 participants

@nnethercote@rustbot@Zalathar@rust-timer@JonathanBrouwer@Zoxc