Move rustc_query_system::query::caches to rustc_middle::query.

This one is straightforward.
This commit is contained in:
Nicholas Nethercote 2026-02-11 14:25:35 +11:00
parent 8b0dc1ece0
commit 940f30792c
13 changed files with 20 additions and 21 deletions

View file

@ -51,6 +51,7 @@
#![feature(range_bounds_is_empty)]
#![feature(rustc_attrs)]
#![feature(sized_hierarchy)]
#![feature(trait_alias)]
#![feature(try_blocks)]
#![feature(try_trait_v2)]
#![feature(try_trait_v2_residual)]

View file

@ -7,10 +7,10 @@ use rustc_data_structures::stable_hasher::HashStable;
pub use rustc_data_structures::vec_cache::VecCache;
use rustc_hir::def_id::LOCAL_CRATE;
use rustc_index::Idx;
use rustc_query_system::ich::StableHashingContext;
use rustc_span::def_id::{DefId, DefIndex};
use crate::dep_graph::DepNodeIndex;
use crate::ich::StableHashingContext;
/// Traits that all query keys must satisfy.
pub trait QueryCacheKey = Hash + Eq + Copy + Debug + for<'a> HashStable<StableHashingContext<'a>>;

View file

@ -2,10 +2,11 @@
//! `tcx.$query(..)` and its variations.
use rustc_query_system::dep_graph::{DepKind, DepNodeKey};
use rustc_query_system::query::{QueryCache, QueryMode};
use rustc_query_system::query::QueryMode;
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
use crate::dep_graph;
use crate::query::QueryCache;
use crate::query::erase::{self, Erasable, Erased};
use crate::query::plumbing::QueryVTable;
use crate::ty::TyCtxt;

View file

@ -6,11 +6,11 @@ use rustc_ast::tokenstream::TokenStream;
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId};
use rustc_hir::hir_id::OwnerId;
use rustc_query_system::dep_graph::DepNodeIndex;
use rustc_query_system::query::{DefIdCache, DefaultCache, SingleCache, VecCache};
use rustc_span::{DUMMY_SP, Ident, LocalExpnId, Span, Symbol};
use crate::infer::canonical::CanonicalQueryInput;
use crate::mir::mono::CollectionMode;
use crate::query::{DefIdCache, DefaultCache, SingleCache, VecCache};
use crate::ty::fast_reject::SimplifiedType;
use crate::ty::layout::ValidityRequirement;
use crate::ty::{self, GenericArg, GenericArgsRef, Ty, TyCtxt};
@ -28,7 +28,7 @@ pub trait Key: Sized {
/// In practice the cache type must implement [`QueryCache`], though that
/// constraint is not enforced here.
///
/// [`QueryCache`]: rustc_query_system::query::QueryCache
/// [`QueryCache`]: rustc_middle::query::QueryCache
type Cache<V> = DefaultCache<Self, V>;
/// In the event that a cycle occurs, if no explicit span has been

View file

@ -1,6 +1,9 @@
use rustc_hir::def_id::LocalDefId;
pub use rustc_query_system::query::QueryMode;
pub use self::caches::{
DefIdCache, DefaultCache, QueryCache, QueryCacheKey, SingleCache, VecCache,
};
pub use self::job::{QueryInfo, QueryJob, QueryJobId, QueryLatch, QueryWaiter};
pub use self::keys::{AsLocalKey, Key, LocalCrate};
pub use self::plumbing::{
@ -12,6 +15,7 @@ pub use crate::queries::Providers;
use crate::ty::TyCtxt;
pub(crate) mod arena_cached;
mod caches;
pub mod erase;
pub(crate) mod inner;
mod job;

View file

@ -9,7 +9,7 @@ use rustc_hir::hir_id::OwnerId;
use rustc_macros::HashStable;
use rustc_query_system::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
use rustc_query_system::ich::StableHashingContext;
use rustc_query_system::query::{CycleErrorHandling, QueryCache};
use rustc_query_system::query::CycleErrorHandling;
use rustc_span::{ErrorGuaranteed, Span};
pub use sealed::IntoQueryParam;
@ -20,7 +20,7 @@ use crate::queries::{
};
use crate::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex, OnDiskCache};
use crate::query::stack::{QueryStackDeferred, QueryStackFrame, QueryStackFrameExtra};
use crate::query::{QueryInfo, QueryJob};
use crate::query::{QueryCache, QueryInfo, QueryJob};
use crate::ty::TyCtxt;
/// For a particular query, keeps track of "active" keys, i.e. keys whose

View file

@ -1,8 +1,8 @@
use rustc_middle::bug;
use rustc_middle::dep_graph::DepKindVTable;
use rustc_middle::query::QueryCache;
use rustc_middle::ty::TyCtxt;
use rustc_query_system::dep_graph::{DepNodeKey, FingerprintStyle};
use rustc_query_system::query::QueryCache;
use crate::plumbing::{force_from_dep_node_inner, try_load_from_on_disk_cache_inner};
use crate::{QueryCtxt, QueryDispatcherUnerased, QueryFlags};

View file

@ -7,14 +7,12 @@ use rustc_data_structures::{outline, sharded, sync};
use rustc_errors::{Diag, FatalError, StashKey};
use rustc_middle::dep_graph::DepsType;
use rustc_middle::query::{
ActiveKeyStatus, CycleError, QueryJob, QueryJobId, QueryLatch, QueryStackDeferred,
ActiveKeyStatus, CycleError, QueryCache, QueryJob, QueryJobId, QueryLatch, QueryStackDeferred,
QueryStackFrame, QueryState,
};
use rustc_middle::ty::TyCtxt;
use rustc_query_system::dep_graph::{DepGraphData, DepNodeKey, HasDepContext};
use rustc_query_system::query::{
CycleErrorHandling, QueryCache, QueryMode, incremental_verify_ich,
};
use rustc_query_system::query::{CycleErrorHandling, QueryMode, incremental_verify_ich};
use rustc_span::{DUMMY_SP, Span};
use crate::dep_graph::{DepContext, DepNode, DepNodeIndex};

View file

@ -20,10 +20,10 @@ use rustc_middle::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex, OnDi
use rustc_middle::query::plumbing::{
HashResult, QueryState, QuerySystem, QuerySystemFns, QueryVTable,
};
use rustc_middle::query::{AsLocalKey, CycleError};
use rustc_middle::query::{AsLocalKey, CycleError, QueryCache};
use rustc_middle::ty::TyCtxt;
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
use rustc_query_system::query::{CycleErrorHandling, QueryCache, QueryMode};
use rustc_query_system::query::{CycleErrorHandling, QueryMode};
use rustc_span::{ErrorGuaranteed, Span};
pub use crate::dep_kind_vtables::make_dep_kind_vtables;

View file

@ -23,14 +23,14 @@ use rustc_middle::query::on_disk_cache::{
};
use rustc_middle::query::plumbing::QueryVTable;
use rustc_middle::query::{
Key, QueryJobId, QueryStackDeferred, QueryStackFrame, QueryStackFrameExtra,
Key, QueryCache, QueryJobId, QueryStackDeferred, QueryStackFrame, QueryStackFrameExtra,
};
use rustc_middle::ty::codec::TyEncoder;
use rustc_middle::ty::print::with_reduced_queries;
use rustc_middle::ty::tls::{self, ImplicitCtxt};
use rustc_middle::ty::{self, TyCtxt};
use rustc_query_system::dep_graph::{DepNodeKey, HasDepContext};
use rustc_query_system::query::{QueryCache, QueryContext, QuerySideEffect};
use rustc_query_system::query::{QueryContext, QuerySideEffect};
use rustc_serialize::{Decodable, Encodable};
use rustc_span::def_id::LOCAL_CRATE;

View file

@ -6,8 +6,8 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::profiling::SelfProfiler;
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, LocalDefId};
use rustc_hir::definitions::DefPathData;
use rustc_middle::query::QueryCache;
use rustc_middle::ty::TyCtxt;
use rustc_query_system::query::QueryCache;
pub(crate) struct QueryKeyStringCache {
def_id_cache: FxHashMap<DefId, StringId>,

View file

@ -2,7 +2,6 @@
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(assert_matches))]
#![feature(min_specialization)]
#![feature(trait_alias)]
// tidy-alphabetical-end
pub mod dep_graph;

View file

@ -4,13 +4,9 @@ use rustc_data_structures::jobserver::Proxy;
use rustc_errors::DiagInner;
use rustc_macros::{Decodable, Encodable};
pub use self::caches::{
DefIdCache, DefaultCache, QueryCache, QueryCacheKey, SingleCache, VecCache,
};
pub use self::plumbing::*;
use crate::dep_graph::{DepNodeIndex, HasDepContext, SerializedDepNodeIndex};
mod caches;
mod plumbing;
/// How a particular query deals with query cycle errors.