@@ -299,34 +299,28 @@ pub(crate) fn create_query_frame<
299299 QueryStackFrame :: new ( name, description, span, def_kind, hash)
300300}
301301
302- pub ( crate ) fn try_load_from_on_disk_cache < ' tcx , K , V > (
302+ pub ( crate ) fn try_load_from_on_disk_cache < ' tcx , K : DepNodeParams < TyCtxt < ' tcx > > , V > (
303303 tcx : TyCtxt < ' tcx > ,
304304 dep_node : DepNode ,
305- recover : fn ( TyCtxt < ' tcx > , DepNode ) -> Option < K > ,
306305 cache_on_disk : fn ( TyCtxt < ' tcx > , & K ) -> bool ,
307306 do_query : fn ( TyCtxt < ' tcx > , K ) -> V ,
308307) {
309308 debug_assert ! ( tcx. dep_graph. is_green( & dep_node) ) ;
310309
311- let key = recover ( tcx, dep_node) . unwrap_or_else ( || {
310+ let key = K :: recover ( tcx, & dep_node) . unwrap_or_else ( || {
312311 panic ! ( "Failed to recover key for {:?} with hash {}" , dep_node, dep_node. hash)
313312 } ) ;
314313 if cache_on_disk ( tcx, & key) {
315314 let _ = do_query ( tcx, key) ;
316315 }
317316}
318317
319- pub ( crate ) fn force_from_dep_node < ' tcx , Q > (
320- tcx : TyCtxt < ' tcx > ,
321- // dep_node: rustc_query_system::dep_graph::DepNode<CTX::DepKind>,
322- dep_node : DepNode ,
323- recover : fn ( TyCtxt < ' tcx > , DepNode ) -> Option < Q :: Key > ,
324- ) -> bool
318+ fn force_from_dep_node < ' tcx , Q > ( tcx : TyCtxt < ' tcx > , dep_node : DepNode ) -> bool
325319where
326320 Q : QueryDescription < QueryCtxt < ' tcx > > ,
327321 Q :: Key : DepNodeParams < TyCtxt < ' tcx > > ,
328322{
329- if let Some ( key) = recover ( tcx, dep_node) {
323+ if let Some ( key) = Q :: Key :: recover ( tcx, & dep_node) {
330324 #[ cfg( debug_assertions) ]
331325 let _guard = tracing:: span!( tracing:: Level :: TRACE , stringify!( $name) , ?key) . entered ( ) ;
332326 let tcx = QueryCtxt :: from_tcx ( tcx) ;
@@ -405,7 +399,6 @@ macro_rules! define_queries {
405399 #[ allow( nonstandard_style) ]
406400 mod query_callbacks {
407401 use super :: * ;
408- use rustc_middle:: dep_graph:: DepNode ;
409402 use rustc_query_system:: dep_graph:: DepNodeParams ;
410403 use rustc_query_system:: query:: QueryDescription ;
411404 use rustc_query_system:: dep_graph:: FingerprintStyle ;
@@ -479,17 +472,14 @@ macro_rules! define_queries {
479472 }
480473 }
481474
482- #[ inline( always) ]
483- fn recover<' tcx>( tcx: TyCtxt <' tcx>, dep_node: DepNode ) -> Option <<queries:: $name<' tcx> as QueryConfig >:: Key > {
484- <<queries:: $name<' _> as QueryConfig >:: Key as DepNodeParams <TyCtxt <' _>>>:: recover( tcx, & dep_node)
485- }
486-
487475 DepKindStruct {
488476 is_anon,
489477 is_eval_always,
490478 fingerprint_style,
491- force_from_dep_node: Some ( |tcx, dep_node| $crate:: plumbing:: force_from_dep_node:: <queries:: $name<' _>>( tcx, dep_node, recover) ) ,
492- try_load_from_on_disk_cache: Some ( |tcx, key| $crate:: plumbing:: try_load_from_on_disk_cache( tcx, key, recover, queries:: $name:: cache_on_disk, TyCtxt :: $name) ) ,
479+ force_from_dep_node: Some ( |tcx, dep_node| $crate:: plumbing:: force_from_dep_node:: <queries:: $name<' _>>( tcx, dep_node) ) ,
480+ try_load_from_on_disk_cache: Some ( |tcx, key| $crate:: plumbing:: try_load_from_on_disk_cache:: <
481+ <queries:: $name<' _> as QueryConfig >:: Key , _
482+ >( tcx, key, queries:: $name:: cache_on_disk, TyCtxt :: $name) ) ,
493483 }
494484 } ) *
495485 }
0 commit comments