Skip to content

Commit 24ce4cf

Browse files
committed
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.
1 parent 167b3bd commit 24ce4cf

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

compiler/rustc_query_impl/src/plumbing.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ pub(crate) fn create_query_frame<
298298
K: Copy + Key + for<'a> HashStable<StableHashingContext<'a>>,
299299
>(
300300
tcx: QueryCtxt<'tcx>,
301-
do_describe: fn(QueryCtxt<'tcx>, K) -> String,
301+
do_describe: fn(TyCtxt<'tcx>, K) -> String,
302302
key: K,
303303
kind: DepKind,
304304
name: &'static str,
@@ -307,7 +307,7 @@ pub(crate) fn create_query_frame<
307307
// Showing visible path instead of any path is not that important in production.
308308
let description = ty::print::with_no_visible_paths!(
309309
// Force filename-line mode to avoid invoking `type_of` query.
310-
ty::print::with_forced_impl_filename_line!(do_describe(tcx, key))
310+
ty::print::with_forced_impl_filename_line!(do_describe(tcx.tcx, key))
311311
);
312312
let description =
313313
if tcx.sess.verbose() { format!("{} [{}]", description, name) } else { description };
@@ -466,10 +466,6 @@ macro_rules! define_queries {
466466
}
467467

468468
impl<'tcx> QueryDescription<QueryCtxt<'tcx>> for queries::$name<'tcx> {
469-
fn describe(tcx: QueryCtxt<'tcx>, key: Self::Key) -> String {
470-
::rustc_middle::query::descs::$name(tcx.tcx, key)
471-
}
472-
473469
#[inline]
474470
fn cache_on_disk(tcx: TyCtxt<'tcx>, key: &Self::Key) -> bool {
475471
::rustc_middle::query::cached::$name(tcx, key)
@@ -583,7 +579,7 @@ macro_rules! define_queries {
583579
use rustc_middle::ty::TyCtxt;
584580
use $crate::plumbing::{QueryStruct, QueryCtxt};
585581
use $crate::profiling_support::QueryKeyStringCache;
586-
use rustc_query_system::query::{QueryDescription, QueryMap};
582+
use rustc_query_system::query::QueryMap;
587583

588584
pub(super) const fn dummy_query_struct<'tcx>() -> QueryStruct<'tcx> {
589585
fn noop_try_collect_active_jobs(_: QueryCtxt<'_>, _: &mut QueryMap) -> Option<()> {
@@ -610,7 +606,7 @@ macro_rules! define_queries {
610606
let make_query = |tcx, key| {
611607
let kind = rustc_middle::dep_graph::DepKind::$name;
612608
let name = stringify!($name);
613-
$crate::plumbing::create_query_frame(tcx, super::queries::$name::describe, key, kind, name)
609+
$crate::plumbing::create_query_frame(tcx, rustc_middle::query::descs::$name, key, kind, name)
614610
};
615611
tcx.queries.$name.try_collect_active_jobs(
616612
tcx,

compiler/rustc_query_system/src/query/config.rs

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ impl<CTX: QueryContext, K, V> QueryVTable<CTX, K, V> {
4949
pub trait QueryDescription<CTX: QueryContext>: QueryConfig {
5050
type Cache: QueryCache<Key = Self::Key, Stored = Self::Stored, Value = Self::Value>;
5151

52-
fn describe(tcx: CTX, key: Self::Key) -> String;
53-
5452
// Don't use this method to access query results, instead use the methods on TyCtxt
5553
fn query_state<'a>(tcx: CTX) -> &'a QueryState<Self::Key>
5654
where

0 commit comments

Comments
 (0)