Remove <CTX: QueryContext> in a bunch of places.
It was only needed by `find_cycle_in_stack()` in job.rs, but needed to be forwarded through dozens of types.
This commit is contained in:
parent
39b0e79285
commit
52cedcab92
8 changed files with 211 additions and 167 deletions
|
@ -40,7 +40,8 @@ impl QueryContext for TyCtxt<'tcx> {
|
|||
|
||||
fn try_collect_active_jobs(
|
||||
&self,
|
||||
) -> Option<FxHashMap<QueryJobId<Self::DepKind>, QueryJobInfo<Self>>> {
|
||||
) -> Option<FxHashMap<QueryJobId<Self::DepKind>, QueryJobInfo<Self::DepKind, Self::Query>>>
|
||||
{
|
||||
self.queries.try_collect_active_jobs()
|
||||
}
|
||||
|
||||
|
@ -365,7 +366,7 @@ macro_rules! define_queries_inner {
|
|||
type Cache = query_storage!([$($modifiers)*][$($K)*, $V]);
|
||||
|
||||
#[inline(always)]
|
||||
fn query_state<'a>(tcx: TyCtxt<$tcx>) -> &'a QueryState<TyCtxt<$tcx>, Self::Cache> {
|
||||
fn query_state<'a>(tcx: TyCtxt<$tcx>) -> &'a QueryState<crate::dep_graph::DepKind, <TyCtxt<$tcx> as QueryContext>::Query, Self::Cache> {
|
||||
&tcx.queries.$name
|
||||
}
|
||||
|
||||
|
@ -520,7 +521,8 @@ macro_rules! define_queries_struct {
|
|||
fallback_extern_providers: Box<Providers>,
|
||||
|
||||
$($(#[$attr])* $name: QueryState<
|
||||
TyCtxt<$tcx>,
|
||||
crate::dep_graph::DepKind,
|
||||
<TyCtxt<$tcx> as QueryContext>::Query,
|
||||
<queries::$name<$tcx> as QueryAccessors<TyCtxt<'tcx>>>::Cache,
|
||||
>,)*
|
||||
}
|
||||
|
@ -541,7 +543,7 @@ macro_rules! define_queries_struct {
|
|||
|
||||
pub(crate) fn try_collect_active_jobs(
|
||||
&self
|
||||
) -> Option<FxHashMap<QueryJobId<crate::dep_graph::DepKind>, QueryJobInfo<TyCtxt<'tcx>>>> {
|
||||
) -> Option<FxHashMap<QueryJobId<crate::dep_graph::DepKind>, QueryJobInfo<crate::dep_graph::DepKind, <TyCtxt<$tcx> as QueryContext>::Query>>> {
|
||||
let mut jobs = FxHashMap::default();
|
||||
|
||||
$(
|
||||
|
|
|
@ -5,8 +5,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::profiling::SelfProfiler;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::DefPathData;
|
||||
use rustc_query_system::query::QueryCache;
|
||||
use rustc_query_system::query::QueryState;
|
||||
use rustc_query_system::query::{QueryCache, QueryContext, QueryState};
|
||||
use std::fmt::Debug;
|
||||
use std::io::Write;
|
||||
|
||||
|
@ -231,7 +230,7 @@ where
|
|||
pub(super) fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
query_name: &'static str,
|
||||
query_state: &QueryState<TyCtxt<'tcx>, C>,
|
||||
query_state: &QueryState<crate::dep_graph::DepKind, <TyCtxt<'tcx> as QueryContext>::Query, C>,
|
||||
string_cache: &mut QueryKeyStringCache,
|
||||
) where
|
||||
C: QueryCache,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use crate::ty::query::queries;
|
||||
use crate::ty::TyCtxt;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_query_system::query::QueryCache;
|
||||
use rustc_query_system::query::QueryState;
|
||||
use rustc_query_system::query::{QueryAccessors, QueryContext};
|
||||
use rustc_query_system::query::{QueryAccessors, QueryCache, QueryContext, QueryState};
|
||||
|
||||
use std::any::type_name;
|
||||
use std::hash::Hash;
|
||||
use std::mem;
|
||||
#[cfg(debug_assertions)]
|
||||
use std::sync::atomic::Ordering;
|
||||
|
@ -38,10 +37,12 @@ struct QueryStats {
|
|||
local_def_id_keys: Option<usize>,
|
||||
}
|
||||
|
||||
fn stats<CTX: QueryContext, C: QueryCache>(
|
||||
name: &'static str,
|
||||
map: &QueryState<CTX, C>,
|
||||
) -> QueryStats {
|
||||
fn stats<D, Q, C>(name: &'static str, map: &QueryState<D, Q, C>) -> QueryStats
|
||||
where
|
||||
D: Copy + Clone + Eq + Hash,
|
||||
Q: Clone,
|
||||
C: QueryCache,
|
||||
{
|
||||
let mut stats = QueryStats {
|
||||
name,
|
||||
#[cfg(debug_assertions)]
|
||||
|
@ -127,7 +128,8 @@ macro_rules! print_stats {
|
|||
|
||||
$($(
|
||||
queries.push(stats::<
|
||||
TyCtxt<'_>,
|
||||
crate::dep_graph::DepKind,
|
||||
<TyCtxt<'_> as QueryContext>::Query,
|
||||
<queries::$name<'_> as QueryAccessors<TyCtxt<'_>>>::Cache,
|
||||
>(
|
||||
stringify!($name),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue