Skip to content

Commit 97b1c31

Browse files
committed
Also restore the wrapper closure for promote_from_disk_fn
This effectively reverses <4284edc>. At that time, I thought GetQueryVTable might be useful for other kinds of static lookup in the future, but after various other simplifications and cleanups that now seems less likely, and this style is more consistent with other vtable-related functions.
1 parent 4b52951 commit 97b1c31

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

compiler/rustc_query_impl/src/dep_kind_vtables.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ where
117117
crate::execution::force_query_dep_node(tcx, query, dep_node)
118118
},
119119
),
120-
promote_from_disk_fn: (can_recover && is_cache_on_disk)
121-
.then_some(promote_from_disk_inner::<Q>),
120+
promote_from_disk_fn: (can_recover && is_cache_on_disk).then_some(|tcx, dep_node| {
121+
let query = Q::query_vtable(tcx);
122+
promote_from_disk_inner(tcx, query, dep_node)
123+
}),
122124
}
123125
}
124126

compiler/rustc_query_impl/src/plumbing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::error::{QueryOverflow, QueryOverflowNote};
2323
use crate::execution::all_inactive;
2424
use crate::job::find_dep_kind_root;
2525
use crate::query_impl::for_each_query_vtable;
26-
use crate::{CollectActiveJobsKind, GetQueryVTable, collect_active_query_jobs};
26+
use crate::{CollectActiveJobsKind, collect_active_query_jobs};
2727

2828
fn depth_limit_error<'tcx>(tcx: TyCtxt<'tcx>, job: QueryJobId) {
2929
let job_map = collect_active_query_jobs(tcx, CollectActiveJobsKind::Full);
@@ -151,15 +151,15 @@ fn verify_query_key_hashes_inner<'tcx, C: QueryCache>(
151151
});
152152
}
153153

154-
/// Implementation of [`DepKindVTable::promote_from_disk_fn`] for queries.
155-
pub(crate) fn promote_from_disk_inner<'tcx, Q: GetQueryVTable<'tcx>>(
154+
/// Inner implementation of [`DepKindVTable::promote_from_disk_fn`] for queries.
155+
pub(crate) fn promote_from_disk_inner<'tcx, C: QueryCache>(
156156
tcx: TyCtxt<'tcx>,
157+
query: &'tcx QueryVTable<'tcx, C>,
157158
dep_node: DepNode,
158159
) {
159-
let query = Q::query_vtable(tcx);
160160
debug_assert!(tcx.dep_graph.is_green(&dep_node));
161161

162-
let key = <Q::Cache as QueryCache>::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| {
162+
let key = C::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| {
163163
panic!(
164164
"Failed to recover key for {dep_node:?} with key fingerprint {}",
165165
dep_node.key_fingerprint

0 commit comments

Comments
 (0)