@@ -15,7 +15,7 @@ use rustc_middle::bug;
1515#[ expect( unused_imports, reason = "used by doc comments" ) ]
1616use rustc_middle:: dep_graph:: DepKindVTable ;
1717use rustc_middle:: dep_graph:: {
18- self , DepNode , DepNodeIndex , DepNodeKey , SerializedDepNodeIndex , dep_kinds,
18+ self , DepKind , DepNode , DepNodeIndex , DepNodeKey , SerializedDepNodeIndex , dep_kinds,
1919} ;
2020use rustc_middle:: query:: on_disk_cache:: {
2121 AbsoluteBytePos , CacheDecoder , CacheEncoder , EncodedDepNodeIndex ,
@@ -123,7 +123,7 @@ pub fn collect_active_jobs_from_all_queries<'tcx>(
123123 if complete { Ok ( job_map_out) } else { Err ( job_map_out) }
124124}
125125
126- pub ( super ) fn try_mark_green < ' tcx > ( tcx : TyCtxt < ' tcx > , dep_node : & dep_graph :: DepNode ) -> bool {
126+ pub ( super ) fn try_mark_green < ' tcx > ( tcx : TyCtxt < ' tcx > , dep_node : & DepNode ) -> bool {
127127 tcx. dep_graph . try_mark_green ( tcx, dep_node) . is_some ( )
128128}
129129
@@ -273,12 +273,17 @@ macro_rules! item_if_cache_on_disk {
273273}
274274
275275/// The deferred part of a deferred query stack frame.
276- fn mk_query_stack_frame_extra < ' tcx , Cache > (
277- ( tcx, vtable, key) : ( TyCtxt < ' tcx > , & ' tcx QueryVTable < ' tcx , Cache > , Cache :: Key ) ,
276+ fn mk_query_stack_frame_extra < ' tcx , K > (
277+ ( tcx, name, dep_kind, description_fn, key) : (
278+ TyCtxt < ' tcx > ,
279+ & ' static str ,
280+ DepKind ,
281+ fn ( TyCtxt < ' tcx > , K ) -> String ,
282+ K ,
283+ ) ,
278284) -> QueryStackFrameExtra
279285where
280- Cache : QueryCache ,
281- Cache :: Key : Key ,
286+ K : Key + Copy ,
282287{
283288 let def_id = key. key_as_def_id ( ) ;
284289
@@ -287,21 +292,21 @@ where
287292 let reduce_queries = with_reduced_queries ( ) ;
288293
289294 // Avoid calling queries while formatting the description
290- let description = ty:: print:: with_no_queries!( ( vtable . description_fn) ( tcx, key) ) ;
295+ let description = ty:: print:: with_no_queries!( description_fn( tcx, key) ) ;
291296 let description = if tcx. sess . verbose_internals ( ) {
292- format ! ( "{description} [{name:?}]" , name = vtable . name )
297+ format ! ( "{description} [{name:?}]" )
293298 } else {
294299 description
295300 } ;
296- let span = if vtable . dep_kind == dep_graph:: dep_kinds:: def_span || reduce_queries {
301+ let span = if dep_kind == dep_graph:: dep_kinds:: def_span || reduce_queries {
297302 // The `def_span` query is used to calculate `default_span`,
298303 // so exit to avoid infinite recursion.
299304 None
300305 } else {
301306 Some ( key. default_span ( tcx) )
302307 } ;
303308
304- let def_kind = if vtable . dep_kind == dep_graph:: dep_kinds:: def_kind || reduce_queries {
309+ let def_kind = if dep_kind == dep_graph:: dep_kinds:: def_kind || reduce_queries {
305310 // Try to avoid infinite recursion.
306311 None
307312 } else {
@@ -331,7 +336,10 @@ where
331336 let def_id: Option < DefId > = key. key_as_def_id ( ) ;
332337 let def_id_for_ty_in_cycle: Option < DefId > = key. def_id_for_ty_in_cycle ( ) ;
333338
334- let info = QueryStackDeferred :: new ( ( tcx, vtable, key) , mk_query_stack_frame_extra) ;
339+ let info = QueryStackDeferred :: new (
340+ ( tcx, vtable. name , vtable. dep_kind , vtable. description_fn , key) ,
341+ mk_query_stack_frame_extra,
342+ ) ;
335343 QueryStackFrame :: new ( info, kind, hash, def_id, def_id_for_ty_in_cycle)
336344}
337345
0 commit comments