Skip to content

Commit 5aebfd6

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 6c12694 commit 5aebfd6

3 files changed

Lines changed: 8 additions & 8 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod values;
5050
trait QueryDispatcherUnerased<'tcx, C: QueryCache> {
5151
type UnerasedValue;
5252

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

5555
fn restore_val(value: C::Value) -> Self::UnerasedValue;
5656
}

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)