@@ -301,18 +301,20 @@ pub(crate) fn create_query_frame<
301
301
QueryStackFrame::new(name, description, span, def_kind, hash)
302
302
}
303
303
304
- pub(crate) fn try_load_from_on_disk_cache<'tcx, K: DepNodeParams<TyCtxt<'tcx>> , V>(
304
+ pub(crate) fn try_load_from_on_disk_cache<'tcx, Q , V>(
305
305
tcx: TyCtxt<'tcx>,
306
306
dep_node: DepNode,
307
- cache_on_disk: fn(TyCtxt<'tcx>, &K) -> bool,
308
- cache_query_deps: fn(TyCtxt<'tcx>, K) -> V,
309
- ) {
307
+ cache_query_deps: fn(TyCtxt<'tcx>, Q::Key) -> V,
308
+ ) where
309
+ Q: QueryDescription<QueryCtxt<'tcx>>,
310
+ Q::Key: DepNodeParams<TyCtxt<'tcx>>,
311
+ {
310
312
debug_assert!(tcx.dep_graph.is_green(&dep_node));
311
313
312
- let key = K ::recover(tcx, &dep_node).unwrap_or_else(|| {
314
+ let key = Q::Key ::recover(tcx, &dep_node).unwrap_or_else(|| {
313
315
panic!("Failed to recover key for {:?} with hash {}", dep_node, dep_node.hash)
314
316
});
315
- if cache_on_disk(tcx, &key) {
317
+ if Q:: cache_on_disk(tcx, &key) {
316
318
let _ = cache_query_deps(tcx, key);
317
319
}
318
320
}
@@ -434,7 +436,6 @@ macro_rules! define_queries {
434
436
#[allow(nonstandard_style)]
435
437
mod query_callbacks {
436
438
use super::*;
437
- use rustc_query_system::query::QueryDescription;
438
439
use rustc_query_system::dep_graph::FingerprintStyle;
439
440
440
441
// We use this for most things when incr. comp. is turned off.
@@ -495,7 +496,7 @@ macro_rules! define_queries {
495
496
type Q<'tcx> = queries::$name<'tcx>;
496
497
497
498
$crate::plumbing::query_callback::<Q<'_>>(
498
- |tcx, key| $crate::plumbing::try_load_from_on_disk_cache::<< Q<'_> as QueryConfig>::Key , _>(tcx, key, <Q<'_>>::cache_on_disk , TyCtxt::$name),
499
+ |tcx, key| $crate::plumbing::try_load_from_on_disk_cache::<Q<'_>, _>(tcx, key, TyCtxt::$name),
499
500
|tcx, key| $crate::plumbing::force_from_dep_node::<Q<'_>>(tcx, key),
500
501
is_anon,
501
502
is_eval_always
0 commit comments