@@ -7,49 +7,62 @@ use rustc_middle::ty::{self, TyCtxt};
77use rustc_session:: config:: DumpSolverProofTree ;
88
99use super :: eval_ctxt:: UseGlobalCache ;
10- use super :: GenerateProofTree ;
10+ use super :: { GenerateProofTree , GoalEvaluationKind } ;
1111
1212#[ derive( Eq , PartialEq , Debug ) ]
1313pub struct WipGoalEvaluation < ' tcx > {
1414 pub uncanonicalized_goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
15+ pub kind : WipGoalEvaluationKind ,
1516 pub evaluation : Option < WipCanonicalGoalEvaluation < ' tcx > > ,
16- pub is_normalizes_to_hack : IsNormalizesToHack ,
1717 pub returned_goals : Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ,
1818}
1919
2020impl < ' tcx > WipGoalEvaluation < ' tcx > {
2121 pub fn finalize ( self ) -> inspect:: GoalEvaluation < ' tcx > {
2222 inspect:: GoalEvaluation {
2323 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+ } ,
2430 evaluation : self . evaluation . unwrap ( ) . finalize ( ) ,
25- is_normalizes_to_hack : self . is_normalizes_to_hack ,
2631 returned_goals : self . returned_goals ,
2732 }
2833 }
2934}
3035
3136#[ derive( Eq , PartialEq , Debug ) ]
3237pub enum WipGoalEvaluationKind {
38+ Root ,
39+ Nested { is_normalizes_to_hack : IsNormalizesToHack } ,
40+ }
41+
42+ #[ derive( Eq , PartialEq , Debug ) ]
43+ pub enum WipCanonicalGoalEvaluationKind {
3344 Overflow ,
3445 CacheHit ( CacheHit ) ,
3546}
3647
3748#[ derive( Eq , PartialEq , Debug ) ]
3849pub struct WipCanonicalGoalEvaluation < ' tcx > {
3950 pub goal : CanonicalInput < ' tcx > ,
40- pub kind : Option < WipGoalEvaluationKind > ,
51+ pub kind : Option < WipCanonicalGoalEvaluationKind > ,
4152 pub revisions : Vec < WipGoalEvaluationStep < ' tcx > > ,
4253 pub result : Option < QueryResult < ' tcx > > ,
4354}
4455
4556impl < ' tcx > WipCanonicalGoalEvaluation < ' tcx > {
4657 pub fn finalize ( self ) -> inspect:: CanonicalGoalEvaluation < ' tcx > {
4758 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)
5164 }
52- None => inspect:: GoalEvaluationKind :: Uncached {
65+ None => inspect:: CanonicalGoalEvaluationKind :: Uncached {
5366 revisions : self
5467 . revisions
5568 . into_iter ( )
@@ -260,15 +273,20 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
260273 self . state . is_none ( )
261274 }
262275
263- pub fn new_goal_evaluation (
276+ pub ( super ) fn new_goal_evaluation (
264277 & mut self ,
265278 goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
266- is_normalizes_to_hack : IsNormalizesToHack ,
279+ kind : GoalEvaluationKind ,
267280 ) -> ProofTreeBuilder < ' tcx > {
268281 self . nested ( || WipGoalEvaluation {
269282 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+ } ,
270289 evaluation : None ,
271- is_normalizes_to_hack,
272290 returned_goals : vec ! [ ] ,
273291 } )
274292 }
@@ -297,7 +315,7 @@ impl<'tcx> ProofTreeBuilder<'tcx> {
297315 }
298316 }
299317
300- pub fn goal_evaluation_kind ( & mut self , kind : WipGoalEvaluationKind ) {
318+ pub fn goal_evaluation_kind ( & mut self , kind : WipCanonicalGoalEvaluationKind ) {
301319 if let Some ( this) = self . as_mut ( ) {
302320 match this {
303321 DebugSolver :: CanonicalGoalEvaluation ( canonical_goal_evaluation) => {
0 commit comments