Skip to content

Remove rustc_query_system::cache.#152199

Open
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rm-rustc_query_system-cache
Open

Remove rustc_query_system::cache.#152199
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rm-rustc_query_system-cache

Conversation

@nnethercote
Copy link
Contributor

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 them into rustc_middle, to where they are used. It also renames the extremely non-descriptive Cache as WithDepNodeCache.

r? @Zalathar

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 them into `rustc_middle`, to where they are used.
It also renames the extremely non-descriptive `Cache` as
`WithDepNodeCache`.
@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.

/// Caches the results of trait selection. This cache is used
/// for things that do not have to do with the parameters in scope.
pub selection_cache: traits::SelectionCache<'tcx, ty::TypingEnv<'tcx>>,
pub selection_cache: SelectionCache<'tcx, ty::TypingEnv<'tcx>>,
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Given that GlobalCtxt holds a lot of different things, the traits:: prefix is providing helpful context, so I don't see a benefit in removing it.

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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants