@@ -54,18 +54,27 @@ impl<'tcx> FulfillmentCtxt<'tcx> {
5454
5555 fn track_fulfillment_errors < ' b , ' a : ' b > (
5656 & ' a self ,
57+ infcx : & InferCtxt < ' tcx > ,
5758 errors : impl IntoIterator < Item = & ' b FulfillmentError < ' tcx > > ,
5859 ) {
5960 if let Some ( tracked_obligations) = & self . tracked_obligations {
60- tracked_obligations. borrow_mut ( ) . extend (
61- errors. into_iter ( ) . map ( |error| FulfilledObligation :: Failure ( error. clone ( ) ) ) ,
62- ) ;
61+ tracked_obligations. borrow_mut ( ) . push ( FulfilledObligation :: Failed {
62+ infcx : infcx. clone ( ) ,
63+ data : errors. into_iter ( ) . map ( Clone :: clone) . collect :: < Vec < _ > > ( ) ,
64+ } ) ;
6365 }
6466 }
6567
66- fn track_fulfillment_success ( & self , predicate : & PredicateObligation < ' tcx > ) {
68+ fn track_fulfillment_success (
69+ & self ,
70+ infcx : & InferCtxt < ' tcx > ,
71+ predicate : & PredicateObligation < ' tcx > ,
72+ ) {
6773 if let Some ( tracked_obligations) = & self . tracked_obligations {
68- tracked_obligations. borrow_mut ( ) . push ( FulfilledObligation :: Success ( predicate. clone ( ) ) ) ;
74+ tracked_obligations. borrow_mut ( ) . push ( FulfilledObligation :: Success {
75+ infcx : infcx. clone ( ) ,
76+ data : predicate. clone ( ) ,
77+ } ) ;
6978 }
7079 }
7180}
@@ -114,7 +123,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
114123 } )
115124 . collect ( ) ;
116125
117- self . track_fulfillment_errors ( & errors) ;
126+ self . track_fulfillment_errors ( infcx , & errors) ;
118127
119128 errors
120129 }
@@ -133,7 +142,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
133142 let ( changed, certainty, nested_goals) =
134143 match infcx. evaluate_root_goal ( goal, GenerateProofTree :: IfEnabled ) . 0 {
135144 Ok ( result) => {
136- self . track_fulfillment_success ( & obligation) ;
145+ self . track_fulfillment_success ( infcx , & obligation) ;
137146 result
138147 }
139148 Err ( NoSolution ) => {
@@ -214,7 +223,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
214223 }
215224 }
216225
217- self . track_fulfillment_errors ( & errors) ;
226+ self . track_fulfillment_errors ( infcx , & errors) ;
218227
219228 errors
220229 }
0 commit comments