From f8b30084ac5ae2845175a89fa66f174d6eb871b2 Mon Sep 17 00:00:00 2001 From: gimbles Date: Fri, 23 Dec 2022 18:39:49 +0530 Subject: Use DepKind instead of &str --- compiler/rustc_query_impl/src/plumbing.rs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'compiler/rustc_query_impl') diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 8d5d84c5db4..9ffcc5672cc 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -66,7 +66,7 @@ impl QueryContext for QueryCtxt<'_> { tls::with_related_context(**self, |icx| icx.query) } - fn try_collect_active_jobs(&self) -> Option { + fn try_collect_active_jobs(&self) -> Option> { self.queries.try_collect_active_jobs(**self) } @@ -195,7 +195,7 @@ impl<'tcx> QueryCtxt<'tcx> { #[derive(Clone, Copy)] pub(crate) struct QueryStruct<'tcx> { - pub try_collect_active_jobs: fn(QueryCtxt<'tcx>, &mut QueryMap) -> Option<()>, + pub try_collect_active_jobs: fn(QueryCtxt<'tcx>, &mut QueryMap) -> Option<()>, pub alloc_self_profile_query_strings: fn(TyCtxt<'tcx>, &mut QueryKeyStringCache), pub encode_query_results: Option, &mut CacheEncoder<'_, 'tcx>, &mut EncodedDepNodeIndex)>, @@ -313,7 +313,7 @@ pub(crate) fn create_query_frame< key: K, kind: DepKind, name: &'static str, -) -> QueryStackFrame { +) -> QueryStackFrame { // Disable visible paths printing for performance reasons. // Showing visible path instead of any path is not that important in production. let description = ty::print::with_no_visible_paths!( @@ -346,7 +346,7 @@ pub(crate) fn create_query_frame< }; let ty_adt_id = key.ty_adt_id(); - QueryStackFrame::new(name, description, span, def_id, def_kind, ty_adt_id, hash) + QueryStackFrame::new(description, span, def_id, def_kind, kind, ty_adt_id, hash) } fn try_load_from_on_disk_cache<'tcx, Q>(tcx: TyCtxt<'tcx>, dep_node: DepNode) @@ -378,7 +378,7 @@ fn force_from_dep_node<'tcx, Q>(tcx: TyCtxt<'tcx>, dep_node: DepNode) -> bool where Q: QueryConfig>, Q::Key: DepNodeParams>, - Q::Value: Value>, + Q::Value: Value, DepKind>, { // We must avoid ever having to call `force_from_dep_node()` for a // `DepNode::codegen_unit`: @@ -402,7 +402,7 @@ where #[cfg(debug_assertions)] let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered(); let tcx = QueryCtxt::from_tcx(tcx); - force_query::(tcx, key, dep_node); + force_query::(tcx, key, dep_node); true } else { false @@ -480,7 +480,7 @@ macro_rules! define_queries { type Cache = query_storage::$name<'tcx>; #[inline(always)] - fn query_state<'a>(tcx: QueryCtxt<'tcx>) -> &'a QueryState + fn query_state<'a>(tcx: QueryCtxt<'tcx>) -> &'a QueryState where QueryCtxt<'tcx>: 'a { &tcx.queries.$name @@ -587,9 +587,10 @@ macro_rules! define_queries { use $crate::plumbing::{QueryStruct, QueryCtxt}; use $crate::profiling_support::QueryKeyStringCache; use rustc_query_system::query::QueryMap; + use rustc_middle::dep_graph::DepKind; pub(super) const fn dummy_query_struct<'tcx>() -> QueryStruct<'tcx> { - fn noop_try_collect_active_jobs(_: QueryCtxt<'_>, _: &mut QueryMap) -> Option<()> { + fn noop_try_collect_active_jobs(_: QueryCtxt<'_>, _: &mut QueryMap) -> Option<()> { None } fn noop_alloc_self_profile_query_strings(_: TyCtxt<'_>, _: &mut QueryKeyStringCache) {} @@ -675,7 +676,8 @@ macro_rules! define_queries_struct { $( $(#[$attr])* $name: QueryState< - as QueryConfig>>::Key + as QueryConfig>>::Key, + rustc_middle::dep_graph::DepKind, >, )* } @@ -684,7 +686,7 @@ macro_rules! define_queries_struct { pub(crate) fn try_collect_active_jobs( &'tcx self, tcx: TyCtxt<'tcx>, - ) -> Option { + ) -> Option> { let tcx = QueryCtxt { tcx, queries: self }; let mut jobs = QueryMap::default(); @@ -718,7 +720,7 @@ macro_rules! define_queries_struct { mode: QueryMode, ) -> Option> { let qcx = QueryCtxt { tcx, queries: self }; - get_query::, _>(qcx, span, key, mode) + get_query::, _, rustc_middle::dep_graph::DepKind>(qcx, span, key, mode) })* } }; -- cgit 1.4.1-3-g733a5