@@ -410,21 +410,7 @@ where
410
410
}
411
411
412
412
if Q :: ANON {
413
- let prof_timer = tcx. profiler ( ) . query_provider ( ) ;
414
-
415
- let ( ( result, dep_node_index) , diagnostics) = with_diagnostics ( |diagnostics| {
416
- tcx. start_query ( job. id , diagnostics, |tcx| {
417
- tcx. dep_graph ( ) . with_anon_task ( Q :: DEP_KIND , || Q :: compute ( tcx, key) )
418
- } )
419
- } ) ;
420
-
421
- prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
422
-
423
- tcx. dep_graph ( ) . read_index ( dep_node_index) ;
424
-
425
- if unlikely ! ( !diagnostics. is_empty( ) ) {
426
- tcx. store_diagnostics_for_anon_node ( dep_node_index, diagnostics) ;
427
- }
413
+ let ( result, dep_node_index) = try_execute_anon_query ( tcx, key, job. id , & Q :: VTABLE ) ;
428
414
429
415
return job. complete ( tcx, result, dep_node_index) ;
430
416
}
@@ -461,6 +447,35 @@ where
461
447
result
462
448
}
463
449
450
+ fn try_execute_anon_query < CTX , K , V > (
451
+ tcx : CTX ,
452
+ key : K ,
453
+ job_id : QueryJobId < CTX :: DepKind > ,
454
+ query : & QueryVtable < CTX , K , V > ,
455
+ ) -> ( V , DepNodeIndex )
456
+ where
457
+ CTX : QueryContext ,
458
+ {
459
+ debug_assert ! ( query. anon) ;
460
+ let prof_timer = tcx. profiler ( ) . query_provider ( ) ;
461
+
462
+ let ( ( result, dep_node_index) , diagnostics) = with_diagnostics ( |diagnostics| {
463
+ tcx. start_query ( job_id, diagnostics, |tcx| {
464
+ tcx. dep_graph ( ) . with_anon_task ( query. dep_kind , || query. compute ( tcx, key) )
465
+ } )
466
+ } ) ;
467
+
468
+ prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
469
+
470
+ tcx. dep_graph ( ) . read_index ( dep_node_index) ;
471
+
472
+ if unlikely ! ( !diagnostics. is_empty( ) ) {
473
+ tcx. store_diagnostics_for_anon_node ( dep_node_index, diagnostics) ;
474
+ }
475
+
476
+ ( result, dep_node_index)
477
+ }
478
+
464
479
fn load_from_disk_and_cache_in_memory < CTX , K , V > (
465
480
tcx : CTX ,
466
481
key : K ,
0 commit comments