@@ -213,6 +213,8 @@ enum WipProbeStep<'tcx> {
213
213
AddGoal ( inspect:: CanonicalState < ' tcx , Goal < ' tcx , ty:: Predicate < ' tcx > > > ) ,
214
214
EvaluateGoals ( WipAddedGoalsEvaluation < ' tcx > ) ,
215
215
NestedProbe ( WipProbe < ' tcx > ) ,
216
+ CommitIfOkStart ,
217
+ CommitIfOkSuccess ,
216
218
}
217
219
218
220
impl < ' tcx > WipProbeStep < ' tcx > {
@@ -221,6 +223,8 @@ impl<'tcx> WipProbeStep<'tcx> {
221
223
WipProbeStep :: AddGoal ( goal) => inspect:: ProbeStep :: AddGoal ( goal) ,
222
224
WipProbeStep :: EvaluateGoals ( eval) => inspect:: ProbeStep :: EvaluateGoals ( eval. finalize ( ) ) ,
223
225
WipProbeStep :: NestedProbe ( probe) => inspect:: ProbeStep :: NestedProbe ( probe. finalize ( ) ) ,
226
+ WipProbeStep :: CommitIfOkStart => inspect:: ProbeStep :: CommitIfOkStart ,
227
+ WipProbeStep :: CommitIfOkSuccess => inspect:: ProbeStep :: CommitIfOkSuccess ,
224
228
}
225
229
}
226
230
}
@@ -458,6 +462,29 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
458
462
}
459
463
}
460
464
465
+ /// Used by `EvalCtxt::commit_if_ok` to flatten the work done inside
466
+ /// of the probe into the parent.
467
+ pub fn integrate_snapshot ( & mut self , probe : ProofTreeBuilder < ' tcx > ) {
468
+ if let Some ( this) = self . as_mut ( ) {
469
+ match ( this, probe. state . unwrap ( ) . tree ) {
470
+ (
471
+ DebugSolver :: Probe ( WipProbe { steps, .. } )
472
+ | DebugSolver :: GoalEvaluationStep ( WipGoalEvaluationStep {
473
+ evaluation : WipProbe { steps, .. } ,
474
+ ..
475
+ } ) ,
476
+ DebugSolver :: Probe ( probe) ,
477
+ ) => {
478
+ steps. push ( WipProbeStep :: CommitIfOkStart ) ;
479
+ assert_eq ! ( probe. kind, None ) ;
480
+ steps. extend ( probe. steps ) ;
481
+ steps. push ( WipProbeStep :: CommitIfOkSuccess ) ;
482
+ }
483
+ _ => unreachable ! ( ) ,
484
+ }
485
+ }
486
+ }
487
+
461
488
pub fn new_evaluate_added_goals ( & mut self ) -> ProofTreeBuilder < ' tcx > {
462
489
self . nested ( || WipAddedGoalsEvaluation { evaluations : vec ! [ ] , result : None } )
463
490
}
0 commit comments