diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-31 16:08:09 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-11-01 17:02:51 +0000 |
| commit | aee4d132e75b5dbd22d98299c0c373cd92b08749 (patch) | |
| tree | 71d3254b9ae6ba270f3767712eecdffca043be93 | |
| parent | 07f19480438e290cab41c3b61478ba993c284824 (diff) | |
| download | rust-aee4d132e75b5dbd22d98299c0c373cd92b08749.tar.gz rust-aee4d132e75b5dbd22d98299c0c373cd92b08749.zip | |
Remove CacheSelector.
| -rw-r--r-- | compiler/rustc_middle/src/ty/query.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/query/caches.rs | 17 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/query/mod.rs | 4 |
3 files changed, 4 insertions, 29 deletions
diff --git a/compiler/rustc_middle/src/ty/query.rs b/compiler/rustc_middle/src/ty/query.rs index ec90590ada2..3258d7fc41d 100644 --- a/compiler/rustc_middle/src/ty/query.rs +++ b/compiler/rustc_middle/src/ty/query.rs @@ -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 { diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs index 85c5af72ef5..51b30a9f36a 100644 --- a/compiler/rustc_query_system/src/query/caches.rs +++ b/compiler/rustc_query_system/src/query/caches.rs @@ -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)] diff --git a/compiler/rustc_query_system/src/query/mod.rs b/compiler/rustc_query_system/src/query/mod.rs index 118703fc0d4..247d55be531 100644 --- a/compiler/rustc_query_system/src/query/mod.rs +++ b/compiler/rustc_query_system/src/query/mod.rs @@ -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}; |
