Skip to content

Move rustc_query_system code, part 3#152516

Open
nnethercote wants to merge 6 commits intorust-lang:mainfrom
nnethercote:mv-query-system-code-3
Open

Move rustc_query_system code, part 3#152516
nnethercote wants to merge 6 commits intorust-lang:mainfrom
nnethercote:mv-query-system-code-3

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Feb 12, 2026

Following on from #152419.

r? @Zalathar

@rustbot
Copy link
Collaborator

rustbot commented Feb 12, 2026

triagebot.toml has been modified, there may have been changes to the review queue.

cc @davidtwco, @wesleywiser

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) labels Feb 12, 2026
@rustbot rustbot added 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 12, 2026
@nnethercote
Copy link
Contributor Author

This PR moves most of what's left in rustc_query_system. There's still a little bit left to remove. Most of it ends up in rustc_middle, which is unfortunate given how big that crate is. But it unlocks a ton of cleanups and simplifications; I already have a whole another PR's worth ready to go.

cc @cjgillot @oli-obk @Zoxc


#[inline]
#[instrument(skip(tcx, dep_graph_data, result, hash_result, format_value), level = "debug")]
pub fn incremental_verify_ich<Tcx, V>(
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Since we’re moving it anyway, this whole incremental_verify_ich chunk looks like a good candidate for its own submodule.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rustc_query_system has a submodule ich and I was wondering about that, but to keep things simple I mostly moved things to modules of the same name when they existed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I haven't gotten around to moving ich to rustc_middle yet.)

Copy link
Member

Choose a reason for hiding this comment

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

From what I can tell, the ich module is the definition of StableHashingContext (used in many places), whereas incremental_verify_ich is some plumbing code that happens to use StableHashingContext. So I suspect that they are more-or-less separate from a module grouping perspective.

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't understand what does exactly "plumbing" mean in context of the query system 😅

Copy link
Member

@Zalathar Zalathar Feb 12, 2026

Choose a reason for hiding this comment

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

I use plumbing as a general term for all the code that happens between when you call tcx.my_query(key), and when it actually calls the underlying query provider.

In terms of the modules named plumbing, I mostly interpret it as “here's the stuff that we didn't pull out into a more meaningfully-named module”, though it also tends to be where all the big complicated query-processing macros are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just imagine it's called utils :P

@nnethercote nnethercote force-pushed the mv-query-system-code-3 branch from 24fad1b to 9906bae Compare February 12, 2026 23:43
@nnethercote
Copy link
Contributor Author

I fixed the test failure. @Zalathar: I'm not sure how far the review process you are, and how strongly you want incremental_verify_ich moved to its own module.

@Zalathar
Copy link
Member

I’m pretty confident that it belongs in a submodule (verify_ich perhaps?), so we might as well do it now in the commit that’s moving the code anyway.

I’d strongly prefer not to move it straight into rustc_middle::query::plumbing when there’s a good alternative.

@Zalathar
Copy link
Member

r=me with a verify_ich submodule integrated into the last commit.

@nnethercote nnethercote force-pushed the mv-query-system-code-3 branch from 9906bae to 5dd7978 Compare February 13, 2026 09:17
@nnethercote
Copy link
Contributor Author

Should be perf-neutral, let's check:

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 13, 2026
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 13, 2026

☀️ Try build successful (CI)
Build commit: a868e96 (a868e9696a8b915fee1d50d874cd6de982a29f0e, parent: 47611e16044c68ef27bac31c35fda2ba1dc20b73)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a868e96): 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 (secondary -7.1%)

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

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-7.1% [-7.1%, -7.1%] 1
All ❌✅ (primary) - - 0

Cycles

Results (secondary -3.3%)

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

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.3% [-5.9%, -2.2%] 4
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 482.691s -> 481.14s (-0.32%)
Artifact size: 398.13 MiB -> 397.92 MiB (-0.05%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 13, 2026
From `rustc_query_state` to `rustc_middle`.
This includes the types `QueryInfo`, `QueryJob`, `QueryJobId`,
`QueryWaiter`, `QueryLatch`, and `QueryLatchInfo`.

`CycleError` and `QueryStack*` had to come along too, due to type
interdependencies. The `QueryStack*` types are put into a new submodule
`rustc_middle::query::stack`.
From `rustc_query_system` to `rustc_middle`.
From `rustc_query_system::query::plumbing` to
`rustc_middle::query::plumbing`.
Most of the files within the `dep_graph` module can be moved wholesale
into `rustc_middle`. But two of them (`mod.rs` and `dep_node.rs`) have
the same name as existing files in `rustc_middle`, so for those I just
copied the contents into the existing files.

The commit also moves `QueryContext` and `incremental_verify_ich*`
because they are tightly intertwined with the dep graph code. And a
couple of error structs moved as well.
@nnethercote nnethercote force-pushed the mv-query-system-code-3 branch from 5dd7978 to ee391fc Compare February 13, 2026 19:45
@rustbot
Copy link
Collaborator

rustbot commented Feb 13, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@nnethercote
Copy link
Contributor Author

Now with a verify_ich module.

@bors r=Zalathar

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 13, 2026

📌 Commit ee391fc has been approved by Zalathar

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2026
@nnethercote
Copy link
Contributor Author

@bors rollup=maybe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants