mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Also restore the wrapper closure for promote_from_disk_fn
This effectively reverses <https://github.com/rust-lang/rust/commit/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.
This commit is contained in:
@@ -117,8 +117,10 @@ pub(crate) fn make_dep_kind_vtable_for_query<'tcx, Q>(
|
||||
crate::execution::force_query_dep_node(tcx, query, dep_node)
|
||||
},
|
||||
),
|
||||
promote_from_disk_fn: (can_recover && is_cache_on_disk)
|
||||
.then_some(promote_from_disk_inner::<Q>),
|
||||
promote_from_disk_fn: (can_recover && is_cache_on_disk).then_some(|tcx, dep_node| {
|
||||
let query = Q::query_vtable(tcx);
|
||||
promote_from_disk_inner(tcx, query, dep_node)
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
use crate::execution::all_inactive;
|
||||
use crate::job::find_dep_kind_root;
|
||||
use crate::query_impl::for_each_query_vtable;
|
||||
use crate::{CollectActiveJobsKind, GetQueryVTable, collect_active_query_jobs};
|
||||
use crate::{CollectActiveJobsKind, collect_active_query_jobs};
|
||||
|
||||
fn depth_limit_error<'tcx>(tcx: TyCtxt<'tcx>, job: QueryJobId) {
|
||||
let job_map = collect_active_query_jobs(tcx, CollectActiveJobsKind::Full);
|
||||
@@ -151,15 +151,15 @@ fn verify_query_key_hashes_inner<'tcx, C: QueryCache>(
|
||||
});
|
||||
}
|
||||
|
||||
/// Implementation of [`DepKindVTable::promote_from_disk_fn`] for queries.
|
||||
pub(crate) fn promote_from_disk_inner<'tcx, Q: GetQueryVTable<'tcx>>(
|
||||
/// Inner implementation of [`DepKindVTable::promote_from_disk_fn`] for queries.
|
||||
pub(crate) fn promote_from_disk_inner<'tcx, C: QueryCache>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
query: &'tcx QueryVTable<'tcx, C>,
|
||||
dep_node: DepNode,
|
||||
) {
|
||||
let query = Q::query_vtable(tcx);
|
||||
debug_assert!(tcx.dep_graph.is_green(&dep_node));
|
||||
|
||||
let key = <Q::Cache as QueryCache>::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| {
|
||||
let key = C::Key::try_recover_key(tcx, &dep_node).unwrap_or_else(|| {
|
||||
panic!(
|
||||
"Failed to recover key for {dep_node:?} with key fingerprint {}",
|
||||
dep_node.key_fingerprint
|
||||
|
||||
Reference in New Issue
Block a user