Skip to content

Commit

Permalink
Remove the describe method from the QueryDescription trait
Browse files Browse the repository at this point in the history
It was called directly already, but now it's even more useless since it
just forwards to the free function. Call it directly.
  • Loading branch information
Noratrieb committed Oct 14, 2022
1 parent 167b3bd commit 24ce4cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 4 additions & 8 deletions compiler/rustc_query_impl/src/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 };
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<()> {
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_query_system/src/query/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24ce4cf

Please sign in to comment.