diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index fb699c6fae0..8e34aba8a9e 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -208,7 +208,7 @@ macro_rules! is_eval_always { macro_rules! query_storage { (<$tcx:tt>[][$K:ty, $V:ty]) => { - <<$K as Key>::CacheSelector as CacheSelector, $K, $V>>::Cache + <<$K as Key>::CacheSelector as CacheSelector<$K, $V>>::Cache }; (<$tcx:tt>[storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => { $ty diff --git a/src/librustc/ty/query/profiling_support.rs b/src/librustc/ty/query/profiling_support.rs index d7972045d12..e0d3e764dad 100644 --- a/src/librustc/ty/query/profiling_support.rs +++ b/src/librustc/ty/query/profiling_support.rs @@ -163,7 +163,7 @@ pub(super) fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>( query_state: &QueryState, C>, string_cache: &mut QueryKeyStringCache, ) where - C: QueryCache>, + C: QueryCache, C::Key: Debug + Clone, { tcx.prof.with_profiler(|profiler| { diff --git a/src/librustc/ty/query/stats.rs b/src/librustc/ty/query/stats.rs index 12e9094fba6..b496bf839ab 100644 --- a/src/librustc/ty/query/stats.rs +++ b/src/librustc/ty/query/stats.rs @@ -38,7 +38,7 @@ struct QueryStats { local_def_id_keys: Option, } -fn stats>( +fn stats( name: &'static str, map: &QueryState, ) -> QueryStats { diff --git a/src/librustc_query_system/query/caches.rs b/src/librustc_query_system/query/caches.rs index f79aa992fd2..51bea58fd80 100644 --- a/src/librustc_query_system/query/caches.rs +++ b/src/librustc_query_system/query/caches.rs @@ -8,11 +8,11 @@ use std::default::Default; use std::hash::Hash; use std::marker::PhantomData; -pub trait CacheSelector { - type Cache: QueryCache; +pub trait CacheSelector { + type Cache: QueryCache; } -pub trait QueryCache: Default { +pub trait QueryCache: Default { type Key: Hash; type Value; type Sharded: Default; @@ -21,7 +21,7 @@ pub trait QueryCache: Default { /// It returns the shard index and a lock guard to the shard, /// which will be used if the query is not in the cache and we need /// to compute it. - fn lookup( + fn lookup( &self, state: &QueryState, key: Self::Key, @@ -33,7 +33,7 @@ pub trait QueryCache: Default { OnHit: FnOnce(&Self::Value, DepNodeIndex) -> R, OnMiss: FnOnce(Self::Key, QueryLookup<'_, CTX, Self::Key, Self::Sharded>) -> R; - fn complete( + fn complete( &self, tcx: CTX, lock_sharded_storage: &mut Self::Sharded, @@ -54,7 +54,7 @@ pub trait QueryCache: Default { pub struct DefaultCacheSelector; -impl CacheSelector for DefaultCacheSelector { +impl CacheSelector for DefaultCacheSelector { type Cache = DefaultCache; } @@ -66,13 +66,13 @@ impl Default for DefaultCache { } } -impl QueryCache for DefaultCache { +impl QueryCache for DefaultCache { type Key = K; type Value = V; type Sharded = FxHashMap; #[inline(always)] - fn lookup( + fn lookup( &self, state: &QueryState, key: K, @@ -92,7 +92,7 @@ impl QueryCache for DefaultCache } #[inline] - fn complete( + fn complete( &self, _: CTX, lock_sharded_storage: &mut Self::Sharded, diff --git a/src/librustc_query_system/query/config.rs b/src/librustc_query_system/query/config.rs index 35828da05bf..4800b66d889 100644 --- a/src/librustc_query_system/query/config.rs +++ b/src/librustc_query_system/query/config.rs @@ -63,7 +63,7 @@ pub trait QueryAccessors: QueryConfig { const EVAL_ALWAYS: bool; const DEP_KIND: CTX::DepKind; - type Cache: QueryCache; + type Cache: QueryCache; // Don't use this method to access query results, instead use the methods on TyCtxt fn query_state<'a>(tcx: CTX) -> &'a QueryState; diff --git a/src/librustc_query_system/query/plumbing.rs b/src/librustc_query_system/query/plumbing.rs index f025a056512..1bba4bd7e88 100644 --- a/src/librustc_query_system/query/plumbing.rs +++ b/src/librustc_query_system/query/plumbing.rs @@ -42,14 +42,14 @@ impl Default for QueryStateShard { } } -pub struct QueryState> { +pub struct QueryState { cache: C, shards: Sharded>, #[cfg(debug_assertions)] pub cache_hits: AtomicUsize, } -impl> QueryState { +impl QueryState { pub(super) fn get_lookup<'tcx>( &'tcx self, key: &C::Key, @@ -77,7 +77,7 @@ enum QueryResult { Poisoned, } -impl> QueryState { +impl QueryState { pub fn iter_results( &self, f: impl for<'a> FnOnce( @@ -122,7 +122,7 @@ impl> QueryState { } } -impl> Default for QueryState { +impl Default for QueryState { fn default() -> QueryState { QueryState { cache: C::default(), @@ -144,7 +144,7 @@ pub struct QueryLookup<'tcx, CTX: QueryContext, K, C> { /// This will poison the relevant query if dropped. struct JobOwner<'tcx, CTX: QueryContext, C> where - C: QueryCache, + C: QueryCache, C::Key: Eq + Hash + Clone + Debug, C::Value: Clone, { @@ -155,7 +155,7 @@ where impl<'tcx, CTX: QueryContext, C> JobOwner<'tcx, CTX, C> where - C: QueryCache, + C: QueryCache, C::Key: Eq + Hash + Clone + Debug, C::Value: Clone, { @@ -292,7 +292,7 @@ where (result, diagnostics.into_inner()) } -impl<'tcx, CTX: QueryContext, C: QueryCache> Drop for JobOwner<'tcx, CTX, C> +impl<'tcx, CTX: QueryContext, C: QueryCache> Drop for JobOwner<'tcx, CTX, C> where C::Key: Eq + Hash + Clone + Debug, C::Value: Clone, @@ -326,7 +326,7 @@ pub struct CycleError { } /// The result of `try_start`. -enum TryGetJob<'tcx, CTX: QueryContext, C: QueryCache> +enum TryGetJob<'tcx, CTX: QueryContext, C: QueryCache> where C::Key: Eq + Hash + Clone + Debug, C::Value: Clone, @@ -358,7 +358,7 @@ fn try_get_cached( on_miss: OnMiss, ) -> R where - C: QueryCache, + C: QueryCache, CTX: QueryContext, OnHit: FnOnce(&C::Value, DepNodeIndex) -> R, OnMiss: FnOnce(C::Key, QueryLookup<'_, CTX, C::Key, C::Sharded>) -> R, @@ -385,7 +385,7 @@ fn try_execute_query( tcx: CTX, span: Span, key: Q::Key, - lookup: QueryLookup<'_, CTX, Q::Key, >::Sharded>, + lookup: QueryLookup<'_, CTX, Q::Key, ::Sharded>, ) -> Q::Value where Q: QueryDescription,