Skip to content

Commit f69a4e1

Browse files
committed
Rename query_dispatcher and reduce its use.
It's now `query_vtable` because its return type changed. And thanks to the previous commit it can be manually inlined in several places. (The only remaining calls to it are in `make_dep_kind_vtable_for_query`, which are more challenging to remove.)
1 parent 98b35cd commit f69a4e1

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

compiler/rustc_query_impl/src/dep_kind_vtables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ where
131131
is_eval_always,
132132
key_fingerprint_style,
133133
force_from_dep_node: Some(|tcx, dep_node, _| {
134-
force_from_dep_node_inner(Q::query_dispatcher(tcx), tcx, dep_node)
134+
force_from_dep_node_inner(Q::query_vtable(tcx), tcx, dep_node)
135135
}),
136136
try_load_from_on_disk_cache: Some(|tcx, dep_node| {
137-
try_load_from_on_disk_cache_inner(Q::query_dispatcher(tcx), tcx, dep_node)
137+
try_load_from_on_disk_cache_inner(Q::query_vtable(tcx), tcx, dep_node)
138138
}),
139139
}
140140
}

compiler/rustc_query_impl/src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ mod job;
3737
mod profiling_support;
3838
mod values;
3939

40-
/// Provides access to vtable-like operations for a query
41-
/// (by creating a [`SemiDynamicQueryDispatcher`]),
42-
/// but also keeps track of the "unerased" value type of the query
43-
/// (i.e. the actual result type in the query declaration).
40+
/// Provides access to vtable-like operations for a query (by creating a
41+
/// `QueryVTable`), but also keeps track of the "unerased" value type of the
42+
/// query (i.e. the actual result type in the query declaration).
4443
///
4544
/// This trait allows some per-query code to be defined in generic functions
4645
/// with a trait bound, instead of having to be defined inline within a macro
@@ -51,7 +50,7 @@ mod values;
5150
trait QueryDispatcherUnerased<'tcx, C: QueryCache> {
5251
type UnerasedValue;
5352

54-
fn query_dispatcher(tcx: TyCtxt<'tcx>) -> &'tcx QueryVTable<'tcx, C>;
53+
fn query_vtable(tcx: TyCtxt<'tcx>) -> &'tcx QueryVTable<'tcx, C>;
5554

5655
fn restore_val(value: C::Value) -> Self::UnerasedValue;
5756
}

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ macro_rules! define_queries {
501501
#[cfg(debug_assertions)]
502502
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
503503
execution::get_query_incr(
504-
QueryType::query_dispatcher(tcx),
504+
&tcx.query_system.query_vtables.$name,
505505
tcx,
506506
span,
507507
key,
@@ -521,7 +521,7 @@ macro_rules! define_queries {
521521
__mode: QueryMode,
522522
) -> Option<Erased<queries::$name::Value<'tcx>>> {
523523
Some(execution::get_query_non_incr(
524-
QueryType::query_dispatcher(tcx),
524+
&tcx.query_system.query_vtables.$name,
525525
tcx,
526526
span,
527527
key,
@@ -628,7 +628,7 @@ macro_rules! define_queries {
628628
type UnerasedValue = queries::$name::Value<'tcx>;
629629

630630
#[inline(always)]
631-
fn query_dispatcher(tcx: TyCtxt<'tcx>)
631+
fn query_vtable(tcx: TyCtxt<'tcx>)
632632
-> &'tcx QueryVTable<'tcx, queries::$name::Storage<'tcx>>
633633
{
634634
&tcx.query_system.query_vtables.$name
@@ -697,7 +697,7 @@ macro_rules! define_queries {
697697
query_impl::$name::QueryType<'tcx>,
698698
_
699699
> (
700-
query_impl::$name::QueryType::query_dispatcher(tcx),
700+
&tcx.query_system.query_vtables.$name,
701701
tcx,
702702
encoder,
703703
query_result_index,
@@ -707,7 +707,7 @@ macro_rules! define_queries {
707707

708708
pub(crate) fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) {
709709
$crate::plumbing::query_key_hash_verify(
710-
query_impl::$name::QueryType::query_dispatcher(tcx),
710+
&tcx.query_system.query_vtables.$name,
711711
tcx,
712712
)
713713
}

0 commit comments

Comments
 (0)