@@ -28,23 +28,31 @@ impl<'tcx> WipGoalEvaluation<'tcx> {
28
28
}
29
29
}
30
30
31
+ #[ derive( Eq , PartialEq , Debug ) ]
32
+ pub enum WipGoalEvaluationKind {
33
+ Overflow ,
34
+ CacheHit ( CacheHit ) ,
35
+ }
36
+
31
37
#[ derive( Eq , PartialEq , Debug ) ]
32
38
pub struct WipCanonicalGoalEvaluation < ' tcx > {
33
39
pub goal : CanonicalInput < ' tcx > ,
34
- pub cache_hit : Option < CacheHit > ,
35
- pub evaluation_steps : Vec < WipGoalEvaluationStep < ' tcx > > ,
40
+ pub kind : Option < WipGoalEvaluationKind > ,
41
+ pub revisions : Vec < WipGoalEvaluationStep < ' tcx > > ,
36
42
pub result : Option < QueryResult < ' tcx > > ,
37
43
}
38
44
39
45
impl < ' tcx > WipCanonicalGoalEvaluation < ' tcx > {
40
46
pub fn finalize ( self ) -> inspect:: CanonicalGoalEvaluation < ' tcx > {
41
- let kind = match self . cache_hit {
42
- Some ( hit) => inspect:: GoalEvaluationKind :: CacheHit ( hit) ,
47
+ let kind = match self . kind {
48
+ Some ( WipGoalEvaluationKind :: Overflow ) => inspect:: GoalEvaluationKind :: Overflow ,
49
+ Some ( WipGoalEvaluationKind :: CacheHit ( hit) ) => {
50
+ inspect:: GoalEvaluationKind :: CacheHit ( hit)
51
+ }
43
52
None => {
44
- assert ! ( !self . evaluation_steps. is_empty( ) ) ;
45
53
inspect:: GoalEvaluationKind :: Uncached {
46
54
revisions : self
47
- . evaluation_steps
55
+ . revisions
48
56
. into_iter ( )
49
57
. map ( WipGoalEvaluationStep :: finalize)
50
58
. collect ( ) ,
@@ -81,24 +89,17 @@ impl<'tcx> WipAddedGoalsEvaluation<'tcx> {
81
89
pub struct WipGoalEvaluationStep < ' tcx > {
82
90
pub instantiated_goal : QueryInput < ' tcx , ty:: Predicate < ' tcx > > ,
83
91
84
- pub added_goals_evaluations : Vec < WipAddedGoalsEvaluation < ' tcx > > ,
85
- pub candidates : Vec < WipGoalCandidate < ' tcx > > ,
86
-
87
- pub result : Option < QueryResult < ' tcx > > ,
92
+ pub evaluation : WipGoalCandidate < ' tcx > ,
88
93
}
89
94
90
95
impl < ' tcx > WipGoalEvaluationStep < ' tcx > {
91
96
pub fn finalize ( self ) -> inspect:: GoalEvaluationStep < ' tcx > {
92
- inspect:: GoalEvaluationStep {
93
- instantiated_goal : self . instantiated_goal ,
94
- added_goals_evaluations : self
95
- . added_goals_evaluations
96
- . into_iter ( )
97
- . map ( WipAddedGoalsEvaluation :: finalize)
98
- . collect ( ) ,
99
- candidates : self . candidates . into_iter ( ) . map ( WipGoalCandidate :: finalize) . collect ( ) ,
100
- result : self . result . unwrap ( ) ,
97
+ let evaluation = self . evaluation . finalize ( ) ;
98
+ match evaluation. kind {
99
+ ProbeKind :: Root { .. } => ( ) ,
100
+ _ => unreachable ! ( "unexpected root evaluation: {evaluation:?}" ) ,
101
101
}
102
+ inspect:: GoalEvaluationStep { instantiated_goal : self . instantiated_goal , evaluation }
102
103
}
103
104
}
104
105
@@ -269,8 +270,8 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
269
270
) -> ProofTreeBuilder < ' tcx > {
270
271
self . nested ( || WipCanonicalGoalEvaluation {
271
272
goal,
272
- cache_hit : None ,
273
- evaluation_steps : vec ! [ ] ,
273
+ kind : None ,
274
+ revisions : vec ! [ ] ,
274
275
result : None ,
275
276
} )
276
277
}
@@ -287,11 +288,11 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
287
288
}
288
289
}
289
290
290
- pub fn cache_hit ( & mut self , cache_hit : CacheHit ) {
291
+ pub fn goal_evaluation_kind ( & mut self , kind : WipGoalEvaluationKind ) {
291
292
if let Some ( this) = self . as_mut ( ) {
292
293
match this {
293
294
DebugSolver :: CanonicalGoalEvaluation ( canonical_goal_evaluation) => {
294
- assert_eq ! ( canonical_goal_evaluation. cache_hit . replace( cache_hit ) , None ) ;
295
+ assert_eq ! ( canonical_goal_evaluation. kind . replace( kind ) , None ) ;
295
296
}
296
297
_ => unreachable ! ( ) ,
297
298
} ;
@@ -330,9 +331,11 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
330
331
) -> ProofTreeBuilder < ' tcx > {
331
332
self . nested ( || WipGoalEvaluationStep {
332
333
instantiated_goal,
333
- added_goals_evaluations : vec ! [ ] ,
334
- candidates : vec ! [ ] ,
335
- result : None ,
334
+ evaluation : WipGoalCandidate {
335
+ added_goals_evaluations : vec ! [ ] ,
336
+ candidates : vec ! [ ] ,
337
+ kind : None ,
338
+ } ,
336
339
} )
337
340
}
338
341
pub fn goal_evaluation_step ( & mut self , goal_evaluation_step : ProofTreeBuilder < ' tcx > ) {
@@ -342,7 +345,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
342
345
DebugSolver :: CanonicalGoalEvaluation ( canonical_goal_evaluations) ,
343
346
DebugSolver :: GoalEvaluationStep ( goal_evaluation_step) ,
344
347
) => {
345
- canonical_goal_evaluations. evaluation_steps . push ( goal_evaluation_step) ;
348
+ canonical_goal_evaluations. revisions . push ( goal_evaluation_step) ;
346
349
}
347
350
_ => unreachable ! ( ) ,
348
351
}
@@ -373,7 +376,10 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
373
376
match ( this, candidate. state . unwrap ( ) . tree ) {
374
377
(
375
378
DebugSolver :: GoalCandidate ( WipGoalCandidate { candidates, .. } )
376
- | DebugSolver :: GoalEvaluationStep ( WipGoalEvaluationStep { candidates, .. } ) ,
379
+ | DebugSolver :: GoalEvaluationStep ( WipGoalEvaluationStep {
380
+ evaluation : WipGoalCandidate { candidates, .. } ,
381
+ ..
382
+ } ) ,
377
383
DebugSolver :: GoalCandidate ( candidate) ,
378
384
) => candidates. push ( candidate) ,
379
385
_ => unreachable ! ( ) ,
@@ -412,7 +418,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
412
418
match ( this, added_goals_evaluation. state . unwrap ( ) . tree ) {
413
419
(
414
420
DebugSolver :: GoalEvaluationStep ( WipGoalEvaluationStep {
415
- added_goals_evaluations,
421
+ evaluation : WipGoalCandidate { added_goals_evaluations, .. } ,
416
422
..
417
423
} )
418
424
| DebugSolver :: GoalCandidate ( WipGoalCandidate {
@@ -432,7 +438,10 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
432
438
assert_eq ! ( canonical_goal_evaluation. result. replace( result) , None ) ;
433
439
}
434
440
DebugSolver :: GoalEvaluationStep ( evaluation_step) => {
435
- assert_eq ! ( evaluation_step. result. replace( result) , None ) ;
441
+ assert_eq ! (
442
+ evaluation_step. evaluation. kind. replace( ProbeKind :: Root { result } ) ,
443
+ None
444
+ ) ;
436
445
}
437
446
_ => unreachable ! ( ) ,
438
447
}
0 commit comments