@@ -305,8 +305,34 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
305305 return ProcessResult :: Unchanged ;
306306 }
307307
308- // This part of the code is much colder.
308+ self . progress_changed_obligations ( pending_obligation)
309+ }
309310
311+ fn process_backedge < ' c , I > (
312+ & mut self ,
313+ cycle : I ,
314+ _marker : PhantomData < & ' c PendingPredicateObligation < ' tcx > > ,
315+ ) where
316+ I : Clone + Iterator < Item = & ' c PendingPredicateObligation < ' tcx > > ,
317+ {
318+ if self . selcx . coinductive_match ( cycle. clone ( ) . map ( |s| s. obligation . predicate ) ) {
319+ debug ! ( "process_child_obligations: coinductive match" ) ;
320+ } else {
321+ let cycle: Vec < _ > = cycle. map ( |c| c. obligation . clone ( ) ) . collect ( ) ;
322+ self . selcx . infcx ( ) . report_overflow_error_cycle ( & cycle) ;
323+ }
324+ }
325+ }
326+
327+ impl < ' a , ' b , ' tcx > FulfillProcessor < ' a , ' b , ' tcx > {
328+ // The code calling this method is extremely hot and only rarely
329+ // actually uses this, so move this part of the code
330+ // out of that loop.
331+ #[ inline( never) ]
332+ fn progress_changed_obligations (
333+ & mut self ,
334+ pending_obligation : & mut PendingPredicateObligation < ' tcx > ,
335+ ) -> ProcessResult < PendingPredicateObligation < ' tcx > , FulfillmentErrorCode < ' tcx > > {
310336 pending_obligation. stalled_on . truncate ( 0 ) ;
311337
312338 let obligation = & mut pending_obligation. obligation ;
@@ -565,23 +591,6 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
565591 }
566592 }
567593
568- fn process_backedge < ' c , I > (
569- & mut self ,
570- cycle : I ,
571- _marker : PhantomData < & ' c PendingPredicateObligation < ' tcx > > ,
572- ) where
573- I : Clone + Iterator < Item = & ' c PendingPredicateObligation < ' tcx > > ,
574- {
575- if self . selcx . coinductive_match ( cycle. clone ( ) . map ( |s| s. obligation . predicate ) ) {
576- debug ! ( "process_child_obligations: coinductive match" ) ;
577- } else {
578- let cycle: Vec < _ > = cycle. map ( |c| c. obligation . clone ( ) ) . collect ( ) ;
579- self . selcx . infcx ( ) . report_overflow_error_cycle ( & cycle) ;
580- }
581- }
582- }
583-
584- impl < ' a , ' b , ' tcx > FulfillProcessor < ' a , ' b , ' tcx > {
585594 fn process_trait_obligation (
586595 & mut self ,
587596 obligation : & PredicateObligation < ' tcx > ,
0 commit comments