Remove the describe method from the QueryDescription trait

It was called directly already, but now it's even more useless since it
just forwards to the free function. Call it directly.
This commit is contained in:
nils 2022-10-13 21:18:36 +02:00
parent 167b3bd3b2
commit 24ce4cfa20
No known key found for this signature in database
2 changed files with 4 additions and 10 deletions

View File

@ -298,7 +298,7 @@ pub(crate) fn create_query_frame<
K: Copy + Key + for<'a> HashStable<StableHashingContext<'a>>, K: Copy + Key + for<'a> HashStable<StableHashingContext<'a>>,
>( >(
tcx: QueryCtxt<'tcx>, tcx: QueryCtxt<'tcx>,
do_describe: fn(QueryCtxt<'tcx>, K) -> String, do_describe: fn(TyCtxt<'tcx>, K) -> String,
key: K, key: K,
kind: DepKind, kind: DepKind,
name: &'static str, name: &'static str,
@ -307,7 +307,7 @@ pub(crate) fn create_query_frame<
// Showing visible path instead of any path is not that important in production. // Showing visible path instead of any path is not that important in production.
let description = ty::print::with_no_visible_paths!( let description = ty::print::with_no_visible_paths!(
// Force filename-line mode to avoid invoking `type_of` query. // Force filename-line mode to avoid invoking `type_of` query.
ty::print::with_forced_impl_filename_line!(do_describe(tcx, key)) ty::print::with_forced_impl_filename_line!(do_describe(tcx.tcx, key))
); );
let description = let description =
if tcx.sess.verbose() { format!("{} [{}]", description, name) } else { description }; if tcx.sess.verbose() { format!("{} [{}]", description, name) } else { description };
@ -466,10 +466,6 @@ macro_rules! define_queries {
} }
impl<'tcx> QueryDescription<QueryCtxt<'tcx>> for queries::$name<'tcx> { impl<'tcx> QueryDescription<QueryCtxt<'tcx>> for queries::$name<'tcx> {
fn describe(tcx: QueryCtxt<'tcx>, key: Self::Key) -> String {
::rustc_middle::query::descs::$name(tcx.tcx, key)
}
#[inline] #[inline]
fn cache_on_disk(tcx: TyCtxt<'tcx>, key: &Self::Key) -> bool { fn cache_on_disk(tcx: TyCtxt<'tcx>, key: &Self::Key) -> bool {
::rustc_middle::query::cached::$name(tcx, key) ::rustc_middle::query::cached::$name(tcx, key)
@ -583,7 +579,7 @@ macro_rules! define_queries {
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use $crate::plumbing::{QueryStruct, QueryCtxt}; use $crate::plumbing::{QueryStruct, QueryCtxt};
use $crate::profiling_support::QueryKeyStringCache; use $crate::profiling_support::QueryKeyStringCache;
use rustc_query_system::query::{QueryDescription, QueryMap}; use rustc_query_system::query::QueryMap;
pub(super) const fn dummy_query_struct<'tcx>() -> QueryStruct<'tcx> { 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<()> {
@ -610,7 +606,7 @@ macro_rules! define_queries {
let make_query = |tcx, key| { let make_query = |tcx, key| {
let kind = rustc_middle::dep_graph::DepKind::$name; let kind = rustc_middle::dep_graph::DepKind::$name;
let name = stringify!($name); let name = stringify!($name);
$crate::plumbing::create_query_frame(tcx, super::queries::$name::describe, key, kind, name) $crate::plumbing::create_query_frame(tcx, rustc_middle::query::descs::$name, key, kind, name)
}; };
tcx.queries.$name.try_collect_active_jobs( tcx.queries.$name.try_collect_active_jobs(
tcx, tcx,

View File

@ -49,8 +49,6 @@ impl<CTX: QueryContext, K, V> QueryVTable<CTX, K, V> {
pub trait QueryDescription<CTX: QueryContext>: QueryConfig { pub trait QueryDescription<CTX: QueryContext>: QueryConfig {
type Cache: QueryCache<Key = Self::Key, Stored = Self::Stored, Value = Self::Value>; type Cache: QueryCache<Key = Self::Key, Stored = Self::Stored, Value = Self::Value>;
fn describe(tcx: CTX, key: Self::Key) -> String;
// Don't use this method to access query results, instead use the methods on TyCtxt // Don't use this method to access query results, instead use the methods on TyCtxt
fn query_state<'a>(tcx: CTX) -> &'a QueryState<Self::Key> fn query_state<'a>(tcx: CTX) -> &'a QueryState<Self::Key>
where where