Remove CacheSelector.
This commit is contained in:
parent
07f1948043
commit
aee4d132e7
3 changed files with 4 additions and 29 deletions
|
@ -120,15 +120,9 @@ macro_rules! query_helper_param_ty {
|
|||
}
|
||||
|
||||
macro_rules! query_storage {
|
||||
([][$K:ty, $V:ty]) => {
|
||||
<DefaultCacheSelector as CacheSelector<$K, $V>>::Cache
|
||||
};
|
||||
([(arena_cache) $($rest:tt)*][$K:ty, $V:ty]) => {
|
||||
<ArenaCacheSelector<'tcx> as CacheSelector<$K, $V>>::Cache
|
||||
};
|
||||
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
|
||||
query_storage!([$($modifiers)*][$($args)*])
|
||||
};
|
||||
([][$K:ty, $V:ty]) => { DefaultCache<$K, $V> };
|
||||
([(arena_cache) $($rest:tt)*][$K:ty, $V:ty]) => { ArenaCache<'tcx, $K, $V> };
|
||||
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => { query_storage!([$($modifiers)*][$($args)*]) };
|
||||
}
|
||||
|
||||
macro_rules! separate_provide_extern_decl {
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue