Skip to content

Commit aee4d13

Browse files
committed
Remove CacheSelector.
1 parent 07f1948 commit aee4d13

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

compiler/rustc_middle/src/ty/query.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,9 @@ macro_rules! query_helper_param_ty {
120120
}
121121

122122
macro_rules! query_storage {
123-
([][$K:ty, $V:ty]) => {
124-
<DefaultCacheSelector as CacheSelector<$K, $V>>::Cache
125-
};
126-
([(arena_cache) $($rest:tt)*][$K:ty, $V:ty]) => {
127-
<ArenaCacheSelector<'tcx> as CacheSelector<$K, $V>>::Cache
128-
};
129-
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
130-
query_storage!([$($modifiers)*][$($args)*])
131-
};
123+
([][$K:ty, $V:ty]) => { DefaultCache<$K, $V> };
124+
([(arena_cache) $($rest:tt)*][$K:ty, $V:ty]) => { ArenaCache<'tcx, $K, $V> };
125+
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => { query_storage!([$($modifiers)*][$($args)*]) };
132126
}
133127

134128
macro_rules! separate_provide_extern_decl {

compiler/rustc_query_system/src/query/caches.rs

-17
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ use rustc_data_structures::sync::WorkerLocal;
1111
use std::default::Default;
1212
use std::fmt::Debug;
1313
use std::hash::Hash;
14-
use std::marker::PhantomData;
15-
16-
pub trait CacheSelector<K, V> {
17-
type Cache;
18-
}
1914

2015
pub trait QueryStorage {
2116
type Value: Debug;
@@ -47,12 +42,6 @@ pub trait QueryCache: QueryStorage + Sized {
4742
fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex));
4843
}
4944

50-
pub struct DefaultCacheSelector;
51-
52-
impl<K: Eq + Hash, V: Clone> CacheSelector<K, V> for DefaultCacheSelector {
53-
type Cache = DefaultCache<K, V>;
54-
}
55-
5645
pub struct DefaultCache<K, V> {
5746
#[cfg(parallel_compiler)]
5847
cache: Sharded<FxHashMap<K, (V, DepNodeIndex)>>,
@@ -134,12 +123,6 @@ where
134123
}
135124
}
136125

137-
pub struct ArenaCacheSelector<'tcx>(PhantomData<&'tcx ()>);
138-
139-
impl<'tcx, K: Eq + Hash, V: 'tcx> CacheSelector<K, V> for ArenaCacheSelector<'tcx> {
140-
type Cache = ArenaCache<'tcx, K, V>;
141-
}
142-
143126
pub struct ArenaCache<'tcx, K, V> {
144127
arena: WorkerLocal<TypedArena<(V, DepNodeIndex)>>,
145128
#[cfg(parallel_compiler)]

compiler/rustc_query_system/src/query/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ pub use self::job::deadlock;
77
pub use self::job::{print_query_stack, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryMap};
88

99
mod caches;
10-
pub use self::caches::{
11-
ArenaCacheSelector, CacheSelector, DefaultCacheSelector, QueryCache, QueryStorage,
12-
};
10+
pub use self::caches::{ArenaCache, DefaultCache, QueryCache, QueryStorage};
1311

1412
mod config;
1513
pub use self::config::{QueryConfig, QueryDescription, QueryVTable};

0 commit comments

Comments
 (0)