@@ -402,7 +402,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
402
402
// expensive for some DepKinds.
403
403
if !self . dep_graph . is_fully_enabled ( ) {
404
404
let null_dep_node = DepNode :: new_no_params ( :: dep_graph:: DepKind :: Null ) ;
405
- return self . force_query_with_job :: < Q > ( key, job, null_dep_node) . map ( | ( v , _ ) | v ) ;
405
+ return Ok ( self . force_query_with_job :: < Q > ( key, job, null_dep_node) . 0 ) ;
406
406
}
407
407
408
408
let dep_node = Q :: to_dep_node ( self , & key) ;
@@ -436,20 +436,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
436
436
437
437
if !dep_node. kind . is_input ( ) {
438
438
if let Some ( dep_node_index) = self . try_mark_green_and_read ( & dep_node) {
439
- return self . load_from_disk_and_cache_in_memory :: < Q > ( key,
440
- job,
441
- dep_node_index,
442
- & dep_node)
439
+ return Ok ( self . load_from_disk_and_cache_in_memory :: < Q > (
440
+ key,
441
+ job,
442
+ dep_node_index,
443
+ & dep_node
444
+ ) )
443
445
}
444
446
}
445
447
446
- match self . force_query_with_job :: < Q > ( key, job, dep_node) {
447
- Ok ( ( result, dep_node_index) ) => {
448
- self . dep_graph . read_index ( dep_node_index) ;
449
- Ok ( result)
450
- }
451
- Err ( e) => Err ( e)
452
- }
448
+ let ( result, dep_node_index) = self . force_query_with_job :: < Q > ( key, job, dep_node) ;
449
+ self . dep_graph . read_index ( dep_node_index) ;
450
+ Ok ( result)
453
451
}
454
452
455
453
fn load_from_disk_and_cache_in_memory < Q : QueryDescription < ' gcx > > (
@@ -458,7 +456,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
458
456
job : JobOwner < ' a , ' gcx , Q > ,
459
457
dep_node_index : DepNodeIndex ,
460
458
dep_node : & DepNode
461
- ) -> Result < Q :: Value , Box < CycleError < ' gcx > > >
459
+ ) -> Q :: Value
462
460
{
463
461
// Note this function can be called concurrently from the same query
464
462
// We must ensure that this is handled correctly
@@ -523,7 +521,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
523
521
524
522
job. complete ( & result, dep_node_index) ;
525
523
526
- Ok ( result)
524
+ result
527
525
}
528
526
529
527
#[ inline( never) ]
@@ -563,7 +561,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
563
561
key : Q :: Key ,
564
562
job : JobOwner < ' _ , ' gcx , Q > ,
565
563
dep_node : DepNode )
566
- -> Result < ( Q :: Value , DepNodeIndex ) , Box < CycleError < ' gcx > > > {
564
+ -> ( Q :: Value , DepNodeIndex ) {
567
565
// If the following assertion triggers, it can have two reasons:
568
566
// 1. Something is wrong with DepNode creation, either here or
569
567
// in DepGraph::try_mark_green()
@@ -610,7 +608,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
610
608
611
609
job. complete ( & result, dep_node_index) ;
612
610
613
- Ok ( ( result, dep_node_index) )
611
+ ( result, dep_node_index)
614
612
}
615
613
616
614
/// Ensure that either this query has all green inputs or been executed.
@@ -657,11 +655,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
657
655
// Ensure that only one of them runs the query
658
656
let job = match JobOwner :: try_get ( self , span, & key) {
659
657
TryGetJob :: NotYetStarted ( job) => job,
660
- TryGetJob :: JobCompleted ( _) => return ,
658
+ TryGetJob :: JobCompleted ( result) => {
659
+ if let Err ( e) = result {
660
+ self . report_cycle ( e) . emit ( ) ;
661
+ }
662
+ return
663
+ }
661
664
} ;
662
- if let Err ( e) = self . force_query_with_job :: < Q > ( key, job, dep_node) {
663
- self . report_cycle ( e) . emit ( ) ;
664
- }
665
+ self . force_query_with_job :: < Q > ( key, job, dep_node) ;
665
666
}
666
667
667
668
pub ( super ) fn try_get_query < Q : QueryDescription < ' gcx > > (
0 commit comments