@@ -393,7 +393,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
393
393
// expensive for some DepKinds.
394
394
if !self . dep_graph . is_fully_enabled ( ) {
395
395
let null_dep_node = DepNode :: new_no_params ( :: dep_graph:: DepKind :: Null ) ;
396
- return self . force_query_with_job :: < Q > ( key, job, null_dep_node) . map ( | ( v , _ ) | v ) ;
396
+ return Ok ( self . force_query_with_job :: < Q > ( key, job, null_dep_node) . 0 ) ;
397
397
}
398
398
399
399
let dep_node = Q :: to_dep_node ( self , & key) ;
@@ -424,20 +424,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
424
424
425
425
if !dep_node. kind . is_input ( ) {
426
426
if let Some ( dep_node_index) = self . try_mark_green_and_read ( & dep_node) {
427
- return self . load_from_disk_and_cache_in_memory :: < Q > ( key,
428
- job,
429
- dep_node_index,
430
- & dep_node)
427
+ return Ok ( self . load_from_disk_and_cache_in_memory :: < Q > (
428
+ key,
429
+ job,
430
+ dep_node_index,
431
+ & dep_node
432
+ ) )
431
433
}
432
434
}
433
435
434
- match self . force_query_with_job :: < Q > ( key, job, dep_node) {
435
- Ok ( ( result, dep_node_index) ) => {
436
- self . dep_graph . read_index ( dep_node_index) ;
437
- Ok ( result)
438
- }
439
- Err ( e) => Err ( e)
440
- }
436
+ let ( result, dep_node_index) = self . force_query_with_job :: < Q > ( key, job, dep_node) ;
437
+ self . dep_graph . read_index ( dep_node_index) ;
438
+ Ok ( result)
441
439
}
442
440
443
441
fn load_from_disk_and_cache_in_memory < Q : QueryDescription < ' gcx > > (
@@ -446,7 +444,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
446
444
job : JobOwner < ' a , ' gcx , Q > ,
447
445
dep_node_index : DepNodeIndex ,
448
446
dep_node : & DepNode
449
- ) -> Result < Q :: Value , Box < CycleError < ' gcx > > >
447
+ ) -> Q :: Value
450
448
{
451
449
// Note this function can be called concurrently from the same query
452
450
// We must ensure that this is handled correctly
@@ -511,7 +509,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
511
509
512
510
job. complete ( & result, dep_node_index) ;
513
511
514
- Ok ( result)
512
+ result
515
513
}
516
514
517
515
#[ inline( never) ]
@@ -551,7 +549,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
551
549
key : Q :: Key ,
552
550
job : JobOwner < ' _ , ' gcx , Q > ,
553
551
dep_node : DepNode )
554
- -> Result < ( Q :: Value , DepNodeIndex ) , Box < CycleError < ' gcx > > > {
552
+ -> ( Q :: Value , DepNodeIndex ) {
555
553
// If the following assertion triggers, it can have two reasons:
556
554
// 1. Something is wrong with DepNode creation, either here or
557
555
// in DepGraph::try_mark_green()
@@ -596,7 +594,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
596
594
597
595
job. complete ( & result, dep_node_index) ;
598
596
599
- Ok ( ( result, dep_node_index) )
597
+ ( result, dep_node_index)
600
598
}
601
599
602
600
/// Ensure that either this query has all green inputs or been executed.
@@ -643,11 +641,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
643
641
// Ensure that only one of them runs the query
644
642
let job = match JobOwner :: try_get ( self , span, & key) {
645
643
TryGetJob :: NotYetStarted ( job) => job,
646
- TryGetJob :: JobCompleted ( _) => return ,
644
+ TryGetJob :: JobCompleted ( result) => {
645
+ if let Err ( e) = result {
646
+ self . report_cycle ( e) . emit ( ) ;
647
+ }
648
+ return
649
+ }
647
650
} ;
648
- if let Err ( e) = self . force_query_with_job :: < Q > ( key, job, dep_node) {
649
- self . report_cycle ( e) . emit ( ) ;
650
- }
651
+ self . force_query_with_job :: < Q > ( key, job, dep_node) ;
651
652
}
652
653
653
654
pub ( super ) fn try_get_query < Q : QueryDescription < ' gcx > > (
0 commit comments