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>>,
>(
tcx: QueryCtxt<'tcx>,
do_describe: fn(QueryCtxt<'tcx>, K) -> String,
do_describe: fn(TyCtxt<'tcx>, K) -> String,
key: K,
kind: DepKind,
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.
let description = ty::print::with_no_visible_paths!(
// 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 =
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> {
fn describe(tcx: QueryCtxt<'tcx>, key: Self::Key) -> String {
::rustc_middle::query::descs::$name(tcx.tcx, key)
}
#[inline]
fn cache_on_disk(tcx: TyCtxt<'tcx>, key: &Self::Key) -> bool {
::rustc_middle::query::cached::$name(tcx, key)
@ -583,7 +579,7 @@ macro_rules! define_queries {
use rustc_middle::ty::TyCtxt;
use $crate::plumbing::{QueryStruct, QueryCtxt};
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> {
fn noop_try_collect_active_jobs(_: QueryCtxt<'_>, _: &mut QueryMap) -> Option<()> {
@ -610,7 +606,7 @@ macro_rules! define_queries {
let make_query = |tcx, key| {
let kind = rustc_middle::dep_graph::DepKind::$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,

View File

@ -49,8 +49,6 @@ impl<CTX: QueryContext, K, V> QueryVTable<CTX, K, V> {
pub trait QueryDescription<CTX: QueryContext>: QueryConfig {
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
fn query_state<'a>(tcx: CTX) -> &'a QueryState<Self::Key>
where