@@ -7,49 +7,62 @@ use rustc_middle::ty::{self, TyCtxt};
7
7
use rustc_session:: config:: DumpSolverProofTree ;
8
8
9
9
use super :: eval_ctxt:: UseGlobalCache ;
10
- use super :: GenerateProofTree ;
10
+ use super :: { GenerateProofTree , GoalEvaluationKind } ;
11
11
12
12
#[ derive( Eq , PartialEq , Debug ) ]
13
13
pub struct WipGoalEvaluation < ' tcx > {
14
14
pub uncanonicalized_goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
15
+ pub kind : WipGoalEvaluationKind ,
15
16
pub evaluation : Option < WipCanonicalGoalEvaluation < ' tcx > > ,
16
- pub is_normalizes_to_hack : IsNormalizesToHack ,
17
17
pub returned_goals : Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ,
18
18
}
19
19
20
20
impl < ' tcx > WipGoalEvaluation < ' tcx > {
21
21
pub fn finalize ( self ) -> inspect:: GoalEvaluation < ' tcx > {
22
22
inspect:: GoalEvaluation {
23
23
uncanonicalized_goal : self . uncanonicalized_goal ,
24
+ kind : match self . kind {
25
+ WipGoalEvaluationKind :: Root => inspect:: GoalEvaluationKind :: Root ,
26
+ WipGoalEvaluationKind :: Nested { is_normalizes_to_hack } => {
27
+ inspect:: GoalEvaluationKind :: Nested { is_normalizes_to_hack }
28
+ }
29
+ } ,
24
30
evaluation : self . evaluation . unwrap ( ) . finalize ( ) ,
25
- is_normalizes_to_hack : self . is_normalizes_to_hack ,
26
31
returned_goals : self . returned_goals ,
27
32
}
28
33
}
29
34
}
30
35
31
36
#[ derive( Eq , PartialEq , Debug ) ]
32
37
pub enum WipGoalEvaluationKind {
38
+ Root ,
39
+ Nested { is_normalizes_to_hack : IsNormalizesToHack } ,
40
+ }
41
+
42
+ #[ derive( Eq , PartialEq , Debug ) ]
43
+ pub enum WipCanonicalGoalEvaluationKind {
33
44
Overflow ,
34
45
CacheHit ( CacheHit ) ,
35
46
}
36
47
37
48
#[ derive( Eq , PartialEq , Debug ) ]
38
49
pub struct WipCanonicalGoalEvaluation < ' tcx > {
39
50
pub goal : CanonicalInput < ' tcx > ,
40
- pub kind : Option < WipGoalEvaluationKind > ,
51
+ pub kind : Option < WipCanonicalGoalEvaluationKind > ,
41
52
pub revisions : Vec < WipGoalEvaluationStep < ' tcx > > ,
42
53
pub result : Option < QueryResult < ' tcx > > ,
43
54
}
44
55
45
56
impl < ' tcx > WipCanonicalGoalEvaluation < ' tcx > {
46
57
pub fn finalize ( self ) -> inspect:: CanonicalGoalEvaluation < ' tcx > {
47
58
let kind = match self . kind {
48
- Some ( WipGoalEvaluationKind :: Overflow ) => inspect:: GoalEvaluationKind :: Overflow ,
49
- Some ( WipGoalEvaluationKind :: CacheHit ( hit) ) => {
50
- inspect:: GoalEvaluationKind :: CacheHit ( hit)
59
+ Some ( WipCanonicalGoalEvaluationKind :: Overflow ) => {
60
+ inspect:: CanonicalGoalEvaluationKind :: Overflow
61
+ }
62
+ Some ( WipCanonicalGoalEvaluationKind :: CacheHit ( hit) ) => {
63
+ inspect:: CanonicalGoalEvaluationKind :: CacheHit ( hit)
51
64
}
52
- None => inspect:: GoalEvaluationKind :: Uncached {
65
+ None => inspect:: CanonicalGoalEvaluationKind :: Uncached {
53
66
revisions : self
54
67
. revisions
55
68
. into_iter ( )
@@ -260,15 +273,20 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
260
273
self . state . is_none ( )
261
274
}
262
275
263
- pub fn new_goal_evaluation (
276
+ pub ( super ) fn new_goal_evaluation (
264
277
& mut self ,
265
278
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
266
- is_normalizes_to_hack : IsNormalizesToHack ,
279
+ kind : GoalEvaluationKind ,
267
280
) -> ProofTreeBuilder < ' tcx > {
268
281
self . nested ( || WipGoalEvaluation {
269
282
uncanonicalized_goal : goal,
283
+ kind : match kind {
284
+ GoalEvaluationKind :: Root => WipGoalEvaluationKind :: Root ,
285
+ GoalEvaluationKind :: Nested { is_normalizes_to_hack } => {
286
+ WipGoalEvaluationKind :: Nested { is_normalizes_to_hack }
287
+ }
288
+ } ,
270
289
evaluation : None ,
271
- is_normalizes_to_hack,
272
290
returned_goals : vec ! [ ] ,
273
291
} )
274
292
}
@@ -297,7 +315,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
297
315
}
298
316
}
299
317
300
- pub fn goal_evaluation_kind ( & mut self , kind : WipGoalEvaluationKind ) {
318
+ pub fn goal_evaluation_kind ( & mut self , kind : WipCanonicalGoalEvaluationKind ) {
301
319
if let Some ( this) = self . as_mut ( ) {
302
320
match this {
303
321
DebugSolver :: CanonicalGoalEvaluation ( canonical_goal_evaluation) => {
0 commit comments