Skip to content

Move rustc_query_system::cache.#152199

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
nnethercote:rm-rustc_query_system-cache
Feb 7, 2026
Merged

Move rustc_query_system::cache.#152199
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
nnethercote:rm-rustc_query_system-cache

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Feb 6, 2026

It only defines two types, Cache and WithDepNode. Neither has anything much to do with queries -- they use DepNodeIndex, that's all.

This commit moves the module into rustc_middle, to where they are used. It also renames the extremely non-descriptive Cache as WithDepNodeCache.

r? @Zalathar

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 6, 2026
@Zalathar
Copy link
Member

Zalathar commented Feb 6, 2026

This looks like a chunk of code that would immediately make sense to extract as a submodule, so moving it inline into rustc_middle::traits::select feels like an unnecessary step backwards, compared to just moving the whole module and fixing up imports.

@nnethercote nnethercote changed the title Remove rustc_query_system::cache. Move rustc_query_system::cache. Feb 7, 2026
Because `Cache` is unhelpfully vague.
@nnethercote nnethercote force-pushed the rm-rustc_query_system-cache branch from 3852205 to b49ab57 Compare February 7, 2026 03:16
@nnethercote
Copy link
Contributor Author

I have updated to preserve the cache module, and just move it from rustc_query_system to rustc_middle.

use crate::dep_graph::{DepContext, DepNodeIndex};

pub struct Cache<Key, Value> {
pub struct WithDepNodeCache<Key, Value> {
Copy link
Member

Choose a reason for hiding this comment

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

Remark: This is a good example of my philosophy that an “inelegant” name is better than a name that is simple but confusing. 👍

@Zalathar
Copy link
Member

Zalathar commented Feb 7, 2026

Thanks for the revisions; I find them very helpful.

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 7, 2026

📌 Commit b49ab57 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 7, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 7, 2026
…cache, r=Zalathar

Move `rustc_query_system::cache`.

It only defines two types, `Cache` and `WithDepNode`. Neither has anything much to do with queries -- they use `DepNodeIndex`, that's all.

This commit moves the module into `rustc_middle`, to where they are used. It also renames the extremely non-descriptive `Cache` as `WithDepNodeCache`.

r? @Zalathar
rust-bors bot pushed a commit that referenced this pull request Feb 7, 2026
Rollup of 4 pull requests

Successful merges:

 - #148590 (Stabilize `atomic_try_update`and deprecate `fetch_update` starting 1.99.0)
 - #150522 (Stabilize new inclusive range type and iterator type)
 - #151576 (Stabilize `core::hint::cold_path`)
 - #152199 (Move `rustc_query_system::cache`.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 7, 2026
…cache, r=Zalathar

Move `rustc_query_system::cache`.

It only defines two types, `Cache` and `WithDepNode`. Neither has anything much to do with queries -- they use `DepNodeIndex`, that's all.

This commit moves the module into `rustc_middle`, to where they are used. It also renames the extremely non-descriptive `Cache` as `WithDepNodeCache`.

r? @Zalathar
rust-bors bot pushed a commit that referenced this pull request Feb 7, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #148590 (Stabilize `atomic_try_update`and deprecate `fetch_update` starting 1.99.0)
 - #150522 (Stabilize new inclusive range type and iterator type)
 - #152235 (Convert to inline diagnostics in `rustc_parse`)
 - #152267 (feat: Implement `int_from_ascii` for `NonZero<T>`)
 - #151576 (Stabilize `core::hint::cold_path`)
 - #151933 (Linker-plugin-based LTO: give an explanation how to use linker-plugin-lto with full LTO)
 - #152010 (Ignore all debuginfo tests for LLDB that we do not run in CI)
 - #152199 (Move `rustc_query_system::cache`.)
@rust-bors rust-bors bot merged commit ae9d2d9 into rust-lang:main Feb 7, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Feb 7, 2026
Rollup merge of #152199 - nnethercote:rm-rustc_query_system-cache, r=Zalathar

Move `rustc_query_system::cache`.

It only defines two types, `Cache` and `WithDepNode`. Neither has anything much to do with queries -- they use `DepNodeIndex`, that's all.

This commit moves the module into `rustc_middle`, to where they are used. It also renames the extremely non-descriptive `Cache` as `WithDepNodeCache`.

r? @Zalathar
@rustbot rustbot added this to the 1.95.0 milestone Feb 7, 2026
@nnethercote nnethercote deleted the rm-rustc_query_system-cache branch February 8, 2026 03:12
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
…fei2009

Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by rust-lang#152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 12, 2026
…fei2009

Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by rust-lang#152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 13, 2026
…fei2009

Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by rust-lang#152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 13, 2026
…fei2009

Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by rust-lang#152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
rust-timer added a commit that referenced this pull request Feb 13, 2026
Rollup merge of #152520 - Zalathar:traits-cache, r=dingxiangfei2009

Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by #152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-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.

3 participants