From f74fd03999bed3686195a1a7d42259ae11331e32 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 8 Mar 2020 18:20:18 +0100 Subject: [PATCH] Make QueryAccessor argument a type. --- src/librustc/ty/query/caches.rs | 15 ++-- src/librustc/ty/query/config.rs | 22 +++-- src/librustc/ty/query/job.rs | 74 ++++++++++------- src/librustc/ty/query/plumbing.rs | 93 ++++++++++++---------- src/librustc/ty/query/profiling_support.rs | 2 +- src/librustc/ty/query/stats.rs | 10 ++- 6 files changed, 127 insertions(+), 89 deletions(-) diff --git a/src/librustc/ty/query/caches.rs b/src/librustc/ty/query/caches.rs index a11b3bcba3e..7dd858142da 100644 --- a/src/librustc/ty/query/caches.rs +++ b/src/librustc/ty/query/caches.rs @@ -23,7 +23,7 @@ pub(crate) trait QueryCache: Default { /// to compute it. fn lookup<'tcx, R, GetCache, OnHit, OnMiss>( &self, - state: &'tcx QueryState<'tcx, Self>, + state: &'tcx QueryState, Self>, get_cache: GetCache, key: Self::Key, // `on_hit` can be called while holding a lock to the query state shard. @@ -32,10 +32,10 @@ fn lookup<'tcx, R, GetCache, OnHit, OnMiss>( ) -> R where GetCache: for<'a> Fn( - &'a mut QueryStateShard<'tcx, Self::Key, Self::Sharded>, + &'a mut QueryStateShard, Self::Key, Self::Sharded>, ) -> &'a mut Self::Sharded, OnHit: FnOnce(&Self::Value, DepNodeIndex) -> R, - OnMiss: FnOnce(Self::Key, QueryLookup<'tcx, Self::Key, Self::Sharded>) -> R; + OnMiss: FnOnce(Self::Key, QueryLookup<'tcx, TyCtxt<'tcx>, Self::Key, Self::Sharded>) -> R; fn complete( &self, @@ -78,17 +78,18 @@ impl QueryCache for DefaultCache { #[inline(always)] fn lookup<'tcx, R, GetCache, OnHit, OnMiss>( &self, - state: &'tcx QueryState<'tcx, Self>, + state: &'tcx QueryState, Self>, get_cache: GetCache, key: K, on_hit: OnHit, on_miss: OnMiss, ) -> R where - GetCache: - for<'a> Fn(&'a mut QueryStateShard<'tcx, K, Self::Sharded>) -> &'a mut Self::Sharded, + GetCache: for<'a> Fn( + &'a mut QueryStateShard, K, Self::Sharded>, + ) -> &'a mut Self::Sharded, OnHit: FnOnce(&V, DepNodeIndex) -> R, - OnMiss: FnOnce(K, QueryLookup<'tcx, K, Self::Sharded>) -> R, + OnMiss: FnOnce(K, QueryLookup<'tcx, TyCtxt<'tcx>, K, Self::Sharded>) -> R, { let mut lookup = state.get_lookup(&key); let lock = &mut *lookup.lock; diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index fc8387ba1ba..eaa1006791b 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -23,7 +23,11 @@ pub trait QueryConfig { type Value: Clone; } -pub(crate) trait QueryAccessors<'tcx>: QueryConfig> { +pub trait QueryContext: Copy { + type Query; +} + +pub(crate) trait QueryAccessors: QueryConfig { const ANON: bool; const EVAL_ALWAYS: bool; const DEP_KIND: DepKind; @@ -31,20 +35,20 @@ pub(crate) trait QueryAccessors<'tcx>: QueryConfig> { type Cache: QueryCache; // Don't use this method to access query results, instead use the methods on TyCtxt - fn query_state<'a>(tcx: TyCtxt<'tcx>) -> &'a QueryState<'tcx, Self::Cache>; + fn query_state<'a>(tcx: CTX) -> &'a QueryState; - fn to_dep_node(tcx: TyCtxt<'tcx>, key: &Self::Key) -> DepNode; + fn to_dep_node(tcx: CTX, key: &Self::Key) -> DepNode; // Don't use this method to compute query results, instead use the methods on TyCtxt - fn compute(tcx: TyCtxt<'tcx>, key: Self::Key) -> Self::Value; + fn compute(tcx: CTX, key: Self::Key) -> Self::Value; fn hash_result(hcx: &mut StableHashingContext<'_>, result: &Self::Value) -> Option; - fn handle_cycle_error(tcx: TyCtxt<'tcx>, error: CycleError<'tcx>) -> Self::Value; + fn handle_cycle_error(tcx: CTX, error: CycleError) -> Self::Value; } -pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { +pub(crate) trait QueryDescription<'tcx>: QueryAccessors> { fn describe(tcx: TyCtxt<'_>, key: Self::Key) -> Cow<'static, str>; #[inline] @@ -57,7 +61,11 @@ fn try_load_from_disk(_: TyCtxt<'tcx>, _: SerializedDepNodeIndex) -> Option> QueryDescription<'tcx> for M { +impl<'tcx, M> QueryDescription<'tcx> for M +where + M: QueryAccessors, Key = DefId>, + //M::Cache: QueryCache, +{ default fn describe(tcx: TyCtxt<'_>, def_id: DefId) -> Cow<'static, str> { if !tcx.sess.verbose() { format!("processing `{}`", tcx.def_path_str(def_id)).into() diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 4e88fc54637..e52c25d86b1 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -1,5 +1,6 @@ use crate::dep_graph::DepKind; use crate::ty::context::TyCtxt; +use crate::ty::query::config::QueryContext; use crate::ty::query::plumbing::CycleError; use crate::ty::query::Query; use crate::ty::tls; @@ -27,13 +28,13 @@ /// Represents a span and a query key. #[derive(Clone, Debug)] -pub struct QueryInfo<'tcx> { +pub struct QueryInfo { /// The span corresponding to the reason for which this query was required. pub span: Span, - pub query: Query<'tcx>, + pub query: CTX::Query, } -type QueryMap<'tcx> = FxHashMap>; +type QueryMap<'tcx> = FxHashMap>>; /// A value uniquely identifiying an active query job within a shard in the query cache. #[derive(Copy, Clone, Eq, PartialEq, Hash)] @@ -72,19 +73,19 @@ fn parent(self, map: &QueryMap<'_>) -> Option { } #[cfg(parallel_compiler)] - fn latch<'a, 'tcx>(self, map: &'a QueryMap<'tcx>) -> Option<&'a QueryLatch<'tcx>> { + fn latch<'a, 'tcx>(self, map: &'a QueryMap<'tcx>) -> Option<&'a QueryLatch>> { map.get(&self).unwrap().job.latch.as_ref() } } -pub struct QueryJobInfo<'tcx> { - pub info: QueryInfo<'tcx>, - pub job: QueryJob<'tcx>, +pub struct QueryJobInfo { + pub info: QueryInfo, + pub job: QueryJob, } /// Represents an active query job. #[derive(Clone)] -pub struct QueryJob<'tcx> { +pub struct QueryJob { pub id: QueryShardJobId, /// The span corresponding to the reason for which this query was required. @@ -95,12 +96,12 @@ pub struct QueryJob<'tcx> { /// The latch that is used to wait on this job. #[cfg(parallel_compiler)] - latch: Option>, + latch: Option>, - dummy: PhantomData>, + dummy: PhantomData>, } -impl<'tcx> QueryJob<'tcx> { +impl QueryJob { /// Creates a new query job. pub fn new(id: QueryShardJobId, span: Span, parent: Option) -> Self { QueryJob { @@ -114,7 +115,7 @@ pub fn new(id: QueryShardJobId, span: Span, parent: Option) -> Self } #[cfg(parallel_compiler)] - pub(super) fn latch(&mut self, _id: QueryJobId) -> QueryLatch<'tcx> { + pub(super) fn latch(&mut self, _id: QueryJobId) -> QueryLatch { if self.latch.is_none() { self.latch = Some(QueryLatch::new()); } @@ -122,7 +123,7 @@ pub(super) fn latch(&mut self, _id: QueryJobId) -> QueryLatch<'tcx> { } #[cfg(not(parallel_compiler))] - pub(super) fn latch(&mut self, id: QueryJobId) -> QueryLatch<'tcx> { + pub(super) fn latch(&mut self, id: QueryJobId) -> QueryLatch { QueryLatch { id, dummy: PhantomData } } @@ -138,14 +139,18 @@ pub fn signal_complete(self) { #[cfg(not(parallel_compiler))] #[derive(Clone)] -pub(super) struct QueryLatch<'tcx> { +pub(super) struct QueryLatch { id: QueryJobId, - dummy: PhantomData<&'tcx ()>, + dummy: PhantomData, } #[cfg(not(parallel_compiler))] -impl<'tcx> QueryLatch<'tcx> { - pub(super) fn find_cycle_in_stack(&self, tcx: TyCtxt<'tcx>, span: Span) -> CycleError<'tcx> { +impl<'tcx> QueryLatch> { + pub(super) fn find_cycle_in_stack( + &self, + tcx: TyCtxt<'tcx>, + span: Span, + ) -> CycleError> { let query_map = tcx.queries.try_collect_active_jobs().unwrap(); // Get the current executing query (waiter) and find the waitee amongst its parents @@ -181,15 +186,15 @@ pub(super) fn find_cycle_in_stack(&self, tcx: TyCtxt<'tcx>, span: Span) -> Cycle } #[cfg(parallel_compiler)] -struct QueryWaiter<'tcx> { +struct QueryWaiter { query: Option, condvar: Condvar, span: Span, - cycle: Lock>>, + cycle: Lock>>, } #[cfg(parallel_compiler)] -impl<'tcx> QueryWaiter<'tcx> { +impl QueryWaiter { fn notify(&self, registry: &rayon_core::Registry) { rayon_core::mark_unblocked(registry); self.condvar.notify_one(); @@ -197,28 +202,34 @@ fn notify(&self, registry: &rayon_core::Registry) { } #[cfg(parallel_compiler)] -struct QueryLatchInfo<'tcx> { +struct QueryLatchInfo { complete: bool, - waiters: Vec>>, + waiters: Vec>>, } #[cfg(parallel_compiler)] #[derive(Clone)] -pub(super) struct QueryLatch<'tcx> { - info: Lrc>>, +pub(super) struct QueryLatch { + info: Lrc>>, } #[cfg(parallel_compiler)] -impl<'tcx> QueryLatch<'tcx> { +impl QueryLatch { fn new() -> Self { QueryLatch { info: Lrc::new(Mutex::new(QueryLatchInfo { complete: false, waiters: Vec::new() })), } } +} +#[cfg(parallel_compiler)] +impl<'tcx> QueryLatch> { /// Awaits for the query job to complete. - #[cfg(parallel_compiler)] - pub(super) fn wait_on(&self, tcx: TyCtxt<'tcx>, span: Span) -> Result<(), CycleError<'tcx>> { + pub(super) fn wait_on( + &self, + tcx: TyCtxt<'tcx>, + span: Span, + ) -> Result<(), CycleError>> { tls::with_related_context(tcx, move |icx| { let waiter = Lrc::new(QueryWaiter { query: icx.query, @@ -237,9 +248,12 @@ pub(super) fn wait_on(&self, tcx: TyCtxt<'tcx>, span: Span) -> Result<(), CycleE } }) } +} +#[cfg(parallel_compiler)] +impl QueryLatch { /// Awaits the caller on this latch by blocking the current thread. - fn wait_on_inner(&self, waiter: &Lrc>) { + fn wait_on_inner(&self, waiter: &Lrc>) { let mut info = self.info.lock(); if !info.complete { // We push the waiter on to the `waiters` list. It can be accessed inside @@ -273,7 +287,7 @@ fn set(&self) { /// Removes a single waiter from the list of waiters. /// This is used to break query cycles. - fn extract_waiter(&self, waiter: usize) -> Lrc> { + fn extract_waiter(&self, waiter: usize) -> Lrc> { let mut info = self.info.lock(); debug_assert!(!info.complete); // Remove the waiter from the list of waiters @@ -427,7 +441,7 @@ fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, QueryJobId)>( fn remove_cycle<'tcx>( query_map: &QueryMap<'tcx>, jobs: &mut Vec, - wakelist: &mut Vec>>, + wakelist: &mut Vec>>>, tcx: TyCtxt<'tcx>, ) -> bool { let mut visited = FxHashSet::default(); diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 82c955778bd..6506e1f83b4 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -4,7 +4,7 @@ use crate::dep_graph::{DepKind, DepNode, DepNodeIndex, SerializedDepNodeIndex}; use crate::ty::query::caches::QueryCache; -use crate::ty::query::config::QueryDescription; +use crate::ty::query::config::{QueryContext, QueryDescription}; use crate::ty::query::job::{QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryShardJobId}; use crate::ty::query::Query; use crate::ty::tls; @@ -29,38 +29,38 @@ #[cfg(debug_assertions)] use std::sync::atomic::{AtomicUsize, Ordering}; -pub(crate) struct QueryStateShard<'tcx, K, C> { +pub(crate) struct QueryStateShard { cache: C, - active: FxHashMap>, + active: FxHashMap>, /// Used to generate unique ids for active jobs. jobs: u32, } -impl<'tcx, K, C> QueryStateShard<'tcx, K, C> { +impl QueryStateShard { fn get_cache(&mut self) -> &mut C { &mut self.cache } } -impl<'tcx, K, C: Default> Default for QueryStateShard<'tcx, K, C> { - fn default() -> QueryStateShard<'tcx, K, C> { +impl Default for QueryStateShard { + fn default() -> QueryStateShard { QueryStateShard { cache: Default::default(), active: Default::default(), jobs: 0 } } } -pub(crate) struct QueryState<'tcx, C: QueryCache> { +pub(crate) struct QueryState { cache: C, - shards: Sharded>, + shards: Sharded>, #[cfg(debug_assertions)] pub(super) cache_hits: AtomicUsize, } -impl<'tcx, C: QueryCache> QueryState<'tcx, C> { +impl QueryState { pub(super) fn get_lookup( &'tcx self, key: &K2, - ) -> QueryLookup<'tcx, C::Key, C::Sharded> { + ) -> QueryLookup<'tcx, CTX, C::Key, C::Sharded> { // We compute the key's hash once and then use it for both the // shard lookup and the hashmap lookup. This relies on the fact // that both of them use `FxHasher`. @@ -75,16 +75,16 @@ pub(super) fn get_lookup( } /// Indicates the state of a query for a given key in a query map. -enum QueryResult<'tcx> { +enum QueryResult { /// An already executing query. The query job can be used to await for its completion. - Started(QueryJob<'tcx>), + Started(QueryJob), /// The query panicked. Queries trying to wait on this will raise a fatal error which will /// silently panic. Poisoned, } -impl<'tcx, C: QueryCache> QueryState<'tcx, C> { +impl QueryState { pub(super) fn iter_results( &self, f: impl for<'a> FnOnce( @@ -101,8 +101,8 @@ pub(super) fn all_inactive(&self) -> bool { pub(super) fn try_collect_active_jobs( &self, kind: DepKind, - make_query: fn(C::Key) -> Query<'tcx>, - jobs: &mut FxHashMap>, + make_query: fn(C::Key) -> CTX::Query, + jobs: &mut FxHashMap>, ) -> Option<()> where C::Key: Clone, @@ -128,8 +128,8 @@ pub(super) fn try_collect_active_jobs( } } -impl<'tcx, C: QueryCache> Default for QueryState<'tcx, C> { - fn default() -> QueryState<'tcx, C> { +impl Default for QueryState { + fn default() -> QueryState { QueryState { cache: C::default(), shards: Default::default(), @@ -140,26 +140,26 @@ fn default() -> QueryState<'tcx, C> { } /// Values used when checking a query cache which can be reused on a cache-miss to execute the query. -pub(crate) struct QueryLookup<'tcx, K, C> { +pub(crate) struct QueryLookup<'tcx, CTX: QueryContext, K, C> { pub(super) key_hash: u64, shard: usize, - pub(super) lock: LockGuard<'tcx, QueryStateShard<'tcx, K, C>>, + pub(super) lock: LockGuard<'tcx, QueryStateShard>, } /// A type representing the responsibility to execute the job in the `job` field. /// This will poison the relevant query if dropped. -struct JobOwner<'tcx, C> +struct JobOwner<'tcx, CTX: QueryContext, C> where C: QueryCache, C::Key: Eq + Hash + Clone + Debug, C::Value: Clone, { - state: &'tcx QueryState<'tcx, C>, + state: &'tcx QueryState, key: C::Key, id: QueryJobId, } -impl<'tcx, C: QueryCache> JobOwner<'tcx, C> +impl<'tcx, C: QueryCache> JobOwner<'tcx, TyCtxt<'tcx>, C> where C: QueryCache, C::Key: Eq + Hash + Clone + Debug, @@ -178,7 +178,7 @@ fn try_start( tcx: TyCtxt<'tcx>, span: Span, key: &C::Key, - mut lookup: QueryLookup<'tcx, C::Key, C::Sharded>, + mut lookup: QueryLookup<'tcx, TyCtxt<'tcx>, C::Key, C::Sharded>, ) -> TryGetJob<'tcx, C> where Q: QueryDescription<'tcx, Key = C::Key, Value = C::Value, Cache = C>, @@ -258,7 +258,14 @@ fn try_start( return TryGetJob::JobCompleted(cached); } } +} +impl<'tcx, CTX: QueryContext, C: QueryCache> JobOwner<'tcx, CTX, C> +where + C: QueryCache, + C::Key: Eq + Hash + Clone + Debug, + C::Value: Clone, +{ /// Completes the query by updating the query cache with the `result`, /// signals the waiter and forgets the JobOwner, so it won't poison the query #[inline(always)] @@ -295,7 +302,7 @@ fn with_diagnostics(f: F) -> (R, ThinVec) (result, diagnostics.into_inner()) } -impl<'tcx, C: QueryCache> Drop for JobOwner<'tcx, C> +impl<'tcx, CTX: QueryContext, C: QueryCache> Drop for JobOwner<'tcx, CTX, C> where C::Key: Eq + Hash + Clone + Debug, C::Value: Clone, @@ -322,10 +329,10 @@ fn drop(&mut self) { } #[derive(Clone)] -pub(crate) struct CycleError<'tcx> { +pub(crate) struct CycleError { /// The query and related span that uses the cycle. - pub(super) usage: Option<(Span, Query<'tcx>)>, - pub(super) cycle: Vec>, + pub(super) usage: Option<(Span, CTX::Query)>, + pub(super) cycle: Vec>, } /// The result of `try_start`. @@ -335,7 +342,7 @@ enum TryGetJob<'tcx, C: QueryCache> C::Value: Clone, { /// The query is not yet started. Contains a guard to the cache eventually used to start it. - NotYetStarted(JobOwner<'tcx, C>), + NotYetStarted(JobOwner<'tcx, TyCtxt<'tcx>, C>), /// The query was already completed. /// Returns the result of the query and its dep-node index @@ -347,6 +354,10 @@ enum TryGetJob<'tcx, C: QueryCache> Cycle(C::Value), } +impl QueryContext for TyCtxt<'tcx> { + type Query = Query<'tcx>; +} + impl<'tcx> TyCtxt<'tcx> { /// Executes a job by changing the `ImplicitCtxt` to point to the /// new query job while it executes. It returns the diagnostics @@ -383,7 +394,7 @@ fn start_query( #[cold] pub(super) fn report_cycle( self, - CycleError { usage, cycle: stack }: CycleError<'tcx>, + CycleError { usage, cycle: stack }: CycleError>, ) -> DiagnosticBuilder<'tcx> { assert!(!stack.is_empty()); @@ -476,7 +487,7 @@ pub fn try_print_query_stack(handler: &Handler) { #[inline(always)] fn try_get_cached( self, - state: &'tcx QueryState<'tcx, C>, + state: &'tcx QueryState, C>, key: C::Key, // `on_hit` can be called while holding a lock to the query cache on_hit: OnHit, @@ -485,11 +496,11 @@ fn try_get_cached( where C: QueryCache, OnHit: FnOnce(&C::Value, DepNodeIndex) -> R, - OnMiss: FnOnce(C::Key, QueryLookup<'tcx, C::Key, C::Sharded>) -> R, + OnMiss: FnOnce(C::Key, QueryLookup<'tcx, TyCtxt<'tcx>, C::Key, C::Sharded>) -> R, { state.cache.lookup( state, - QueryStateShard::::get_cache, + QueryStateShard::, C::Key, C::Sharded>::get_cache, key, |value, index| { if unlikely!(self.prof.enabled()) { @@ -529,7 +540,7 @@ fn try_execute_query + 'tcx>( self, span: Span, key: Q::Key, - lookup: QueryLookup<'tcx, Q::Key, ::Sharded>, + lookup: QueryLookup<'tcx, TyCtxt<'tcx>, Q::Key, ::Sharded>, ) -> Q::Value { let job = match JobOwner::try_start::(self, span, &key, lookup) { TryGetJob::NotYetStarted(job) => job, @@ -690,7 +701,7 @@ fn incremental_verify_ich>( fn force_query_with_job + 'tcx>( self, key: Q::Key, - job: JobOwner<'tcx, Q::Cache>, + job: JobOwner<'tcx, TyCtxt<'tcx>, Q::Cache>, dep_node: DepNode, ) -> (Q::Value, DepNodeIndex) { // If the following assertion triggers, it can have two reasons: @@ -963,7 +974,7 @@ pub struct $name<$tcx> { const CATEGORY: ProfileCategory = $category; } - impl<$tcx> QueryAccessors<$tcx> for queries::$name<$tcx> { + impl<$tcx> QueryAccessors> for queries::$name<$tcx> { const ANON: bool = is_anon!([$($modifiers)*]); const EVAL_ALWAYS: bool = is_eval_always!([$($modifiers)*]); const DEP_KIND: dep_graph::DepKind = dep_graph::DepKind::$node; @@ -971,7 +982,7 @@ impl<$tcx> QueryAccessors<$tcx> for queries::$name<$tcx> { type Cache = query_storage!([$($modifiers)*][$K, $V]); #[inline(always)] - fn query_state<'a>(tcx: TyCtxt<$tcx>) -> &'a QueryState<$tcx, Self::Cache> { + fn query_state<'a>(tcx: TyCtxt<$tcx>) -> &'a QueryState, Self::Cache> { &tcx.queries.$name } @@ -1002,7 +1013,7 @@ fn hash_result( fn handle_cycle_error( tcx: TyCtxt<'tcx>, - error: CycleError<'tcx> + error: CycleError> ) -> Self::Value { handle_cycle_error!([$($modifiers)*][tcx, error]) } @@ -1124,8 +1135,8 @@ pub struct Queries<$tcx> { fallback_extern_providers: Box>, $($(#[$attr])* $name: QueryState< - $tcx, - as QueryAccessors<'tcx>>::Cache, + TyCtxt<$tcx>, + as QueryAccessors>>::Cache, >,)* } @@ -1145,12 +1156,12 @@ pub(crate) fn new( pub(crate) fn try_collect_active_jobs( &self - ) -> Option>> { + ) -> Option>>> { let mut jobs = FxHashMap::default(); $( self.$name.try_collect_active_jobs( - as QueryAccessors<'tcx>>::DEP_KIND, + as QueryAccessors>>::DEP_KIND, Query::$name, &mut jobs, )?; diff --git a/src/librustc/ty/query/profiling_support.rs b/src/librustc/ty/query/profiling_support.rs index 0081794051f..a540a18a19f 100644 --- a/src/librustc/ty/query/profiling_support.rs +++ b/src/librustc/ty/query/profiling_support.rs @@ -160,7 +160,7 @@ impl IntoSelfProfilingString for (T0, T1) pub(super) fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>( tcx: TyCtxt<'tcx>, query_name: &'static str, - query_state: &QueryState<'tcx, C>, + query_state: &QueryState, C>, string_cache: &mut QueryKeyStringCache, ) where C: QueryCache, diff --git a/src/librustc/ty/query/stats.rs b/src/librustc/ty/query/stats.rs index 527bb46c908..e6578d1eb5f 100644 --- a/src/librustc/ty/query/stats.rs +++ b/src/librustc/ty/query/stats.rs @@ -1,5 +1,5 @@ use crate::ty::query::caches::QueryCache; -use crate::ty::query::config::QueryAccessors; +use crate::ty::query::config::{QueryAccessors, QueryContext}; use crate::ty::query::plumbing::QueryState; use crate::ty::query::queries; use crate::ty::TyCtxt; @@ -38,7 +38,10 @@ struct QueryStats { local_def_id_keys: Option, } -fn stats<'tcx, C: QueryCache>(name: &'static str, map: &QueryState<'tcx, C>) -> QueryStats { +fn stats( + name: &'static str, + map: &QueryState, +) -> QueryStats { let mut stats = QueryStats { name, #[cfg(debug_assertions)] @@ -124,7 +127,8 @@ fn query_stats(tcx: TyCtxt<'_>) -> Vec { $($( queries.push(stats::< - as QueryAccessors<'_>>::Cache, + TyCtxt<'_>, + as QueryAccessors>>::Cache, >( stringify!($name), &tcx.queries.$name, -- 2.44.0