@@ -402,7 +402,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
402402 // expensive for some DepKinds.
403403 if !self . dep_graph . is_fully_enabled ( ) {
404404 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 ) ;
406406 }
407407
408408 let dep_node = Q :: to_dep_node ( self , & key) ;
@@ -436,20 +436,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
436436
437437 if !dep_node. kind . is_input ( ) {
438438 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+ ) )
443445 }
444446 }
445447
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)
453451 }
454452
455453 fn load_from_disk_and_cache_in_memory < Q : QueryDescription < ' gcx > > (
@@ -458,7 +456,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
458456 job : JobOwner < ' a , ' gcx , Q > ,
459457 dep_node_index : DepNodeIndex ,
460458 dep_node : & DepNode
461- ) -> Result < Q :: Value , Box < CycleError < ' gcx > > >
459+ ) -> Q :: Value
462460 {
463461 // Note this function can be called concurrently from the same query
464462 // We must ensure that this is handled correctly
@@ -523,7 +521,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
523521
524522 job. complete ( & result, dep_node_index) ;
525523
526- Ok ( result)
524+ result
527525 }
528526
529527 #[ inline( never) ]
@@ -563,7 +561,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
563561 key : Q :: Key ,
564562 job : JobOwner < ' _ , ' gcx , Q > ,
565563 dep_node : DepNode )
566- -> Result < ( Q :: Value , DepNodeIndex ) , Box < CycleError < ' gcx > > > {
564+ -> ( Q :: Value , DepNodeIndex ) {
567565 // If the following assertion triggers, it can have two reasons:
568566 // 1. Something is wrong with DepNode creation, either here or
569567 // in DepGraph::try_mark_green()
@@ -610,7 +608,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
610608
611609 job. complete ( & result, dep_node_index) ;
612610
613- Ok ( ( result, dep_node_index) )
611+ ( result, dep_node_index)
614612 }
615613
616614 /// Ensure that either this query has all green inputs or been executed.
@@ -657,11 +655,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
657655 // Ensure that only one of them runs the query
658656 let job = match JobOwner :: try_get ( self , span, & key) {
659657 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+ }
661664 } ;
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) ;
665666 }
666667
667668 pub ( super ) fn try_get_query < Q : QueryDescription < ' gcx > > (
0 commit comments