Skip to content

Commit 2db7f60

Browse files
committed
Unpack type arguments for QueryStateShard.
1 parent 6c4a49e commit 2db7f60

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/librustc/ty/query/plumbing.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use crate::dep_graph::{DepNode, DepNodeIndex, SerializedDepNodeIndex};
66
use crate::ty::query::caches::QueryCache;
7-
use crate::ty::query::config::{QueryAccessors, QueryDescription};
7+
use crate::ty::query::config::{QueryAccessors, QueryConfig, QueryDescription};
88
use crate::ty::query::job::{QueryInfo, QueryJob, QueryJobId, QueryShardJobId};
99
use crate::ty::query::Query;
1010
use crate::ty::tls;
@@ -27,25 +27,32 @@ use std::ptr;
2727
#[cfg(debug_assertions)]
2828
use std::sync::atomic::{AtomicUsize, Ordering};
2929

30-
pub(crate) struct QueryStateShard<'tcx, D: QueryAccessors<'tcx> + ?Sized> {
31-
pub(super) cache: <<D as QueryAccessors<'tcx>>::Cache as QueryCache<D::Key, D::Value>>::Sharded,
32-
pub(super) active: FxHashMap<D::Key, QueryResult<'tcx>>,
30+
pub(crate) type QueryStateShard<'tcx, Q> = QueryStateShardImpl<
31+
'tcx,
32+
<Q as QueryConfig<'tcx>>::Key,
33+
<<Q as QueryAccessors<'tcx>>::Cache as QueryCache<
34+
<Q as QueryConfig<'tcx>>::Key,
35+
<Q as QueryConfig<'tcx>>::Value,
36+
>>::Sharded,
37+
>;
38+
39+
pub(crate) struct QueryStateShardImpl<'tcx, K, C> {
40+
pub(super) cache: C,
41+
pub(super) active: FxHashMap<K, QueryResult<'tcx>>,
3342

3443
/// Used to generate unique ids for active jobs.
3544
pub(super) jobs: u32,
3645
}
3746

38-
impl<'tcx, Q: QueryAccessors<'tcx>> QueryStateShard<'tcx, Q> {
39-
fn get_cache(
40-
&mut self,
41-
) -> &mut <<Q as QueryAccessors<'tcx>>::Cache as QueryCache<Q::Key, Q::Value>>::Sharded {
47+
impl<'tcx, K, C> QueryStateShardImpl<'tcx, K, C> {
48+
fn get_cache(&mut self) -> &mut C {
4249
&mut self.cache
4350
}
4451
}
4552

46-
impl<'tcx, Q: QueryAccessors<'tcx>> Default for QueryStateShard<'tcx, Q> {
47-
fn default() -> QueryStateShard<'tcx, Q> {
48-
QueryStateShard { cache: Default::default(), active: Default::default(), jobs: 0 }
53+
impl<'tcx, K, C: Default> Default for QueryStateShardImpl<'tcx, K, C> {
54+
fn default() -> QueryStateShardImpl<'tcx, K, C> {
55+
QueryStateShardImpl { cache: Default::default(), active: Default::default(), jobs: 0 }
4956
}
5057
}
5158

0 commit comments

Comments
 (0)