Remove CacheSelector.

This commit is contained in:
Camille GILLOT 2022-10-31 16:08:09 +00:00
parent 07f1948043
commit aee4d132e7
3 changed files with 4 additions and 29 deletions

View file

@ -11,11 +11,6 @@ use rustc_data_structures::sync::WorkerLocal;
use std::default::Default;
use std::fmt::Debug;
use std::hash::Hash;
use std::marker::PhantomData;
pub trait CacheSelector<K, V> {
type Cache;
}
pub trait QueryStorage {
type Value: Debug;
@ -47,12 +42,6 @@ pub trait QueryCache: QueryStorage + Sized {
fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex));
}
pub struct DefaultCacheSelector;
impl<K: Eq + Hash, V: Clone> CacheSelector<K, V> for DefaultCacheSelector {
type Cache = DefaultCache<K, V>;
}
pub struct DefaultCache<K, V> {
#[cfg(parallel_compiler)]
cache: Sharded<FxHashMap<K, (V, DepNodeIndex)>>,
@ -134,12 +123,6 @@ where
}
}
pub struct ArenaCacheSelector<'tcx>(PhantomData<&'tcx ()>);
impl<'tcx, K: Eq + Hash, V: 'tcx> CacheSelector<K, V> for ArenaCacheSelector<'tcx> {
type Cache = ArenaCache<'tcx, K, V>;
}
pub struct ArenaCache<'tcx, K, V> {
arena: WorkerLocal<TypedArena<(V, DepNodeIndex)>>,
#[cfg(parallel_compiler)]

View file

@ -7,9 +7,7 @@ pub use self::job::deadlock;
pub use self::job::{print_query_stack, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryMap};
mod caches;
pub use self::caches::{
ArenaCacheSelector, CacheSelector, DefaultCacheSelector, QueryCache, QueryStorage,
};
pub use self::caches::{ArenaCache, DefaultCache, QueryCache, QueryStorage};
mod config;
pub use self::config::{QueryConfig, QueryDescription, QueryVTable};