@@ -28,8 +28,8 @@ use std::ops::ControlFlow;
28
28
use crate :: traits:: vtable:: { count_own_vtable_entries, prepare_vtable_segments, VtblSegment } ;
29
29
30
30
use super :: inspect:: ProofTreeBuilder ;
31
- use super :: search_graph;
32
31
use super :: SolverMode ;
32
+ use super :: { search_graph, GoalEvaluationKind } ;
33
33
use super :: { search_graph:: SearchGraph , Goal } ;
34
34
pub use select:: InferCtxtSelectExt ;
35
35
@@ -85,7 +85,7 @@ pub struct EvalCtxt<'a, 'tcx> {
85
85
// evaluation code.
86
86
tainted : Result < ( ) , NoSolution > ,
87
87
88
- inspect : ProofTreeBuilder < ' tcx > ,
88
+ pub ( super ) inspect : ProofTreeBuilder < ' tcx > ,
89
89
}
90
90
91
91
#[ derive( Debug , Clone ) ]
@@ -164,7 +164,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
164
164
Option < inspect:: GoalEvaluation < ' tcx > > ,
165
165
) {
166
166
EvalCtxt :: enter_root ( self , generate_proof_tree, |ecx| {
167
- ecx. evaluate_goal ( IsNormalizesToHack :: No , goal)
167
+ ecx. evaluate_goal ( GoalEvaluationKind :: Root , goal)
168
168
} )
169
169
}
170
170
}
@@ -340,11 +340,11 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
340
340
/// been constrained and the certainty of the result.
341
341
fn evaluate_goal (
342
342
& mut self ,
343
- is_normalizes_to_hack : IsNormalizesToHack ,
343
+ goal_evaluation_kind : GoalEvaluationKind ,
344
344
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
345
345
) -> Result < ( bool , Certainty , Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ) , NoSolution > {
346
346
let ( orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
347
- let mut goal_evaluation = self . inspect . new_goal_evaluation ( goal, is_normalizes_to_hack ) ;
347
+ let mut goal_evaluation = self . inspect . new_goal_evaluation ( goal, goal_evaluation_kind ) ;
348
348
let encountered_overflow = self . search_graph . encountered_overflow ( ) ;
349
349
let canonical_response = EvalCtxt :: evaluate_canonical_goal (
350
350
self . tcx ( ) ,
@@ -389,7 +389,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
389
389
// solver cycle.
390
390
if cfg ! ( debug_assertions)
391
391
&& has_changed
392
- && is_normalizes_to_hack == IsNormalizesToHack :: No
392
+ && !matches ! (
393
+ goal_evaluation_kind,
394
+ GoalEvaluationKind :: Nested { is_normalizes_to_hack: IsNormalizesToHack :: Yes }
395
+ )
393
396
&& !self . search_graph . in_cycle ( )
394
397
{
395
398
// The nested evaluation has to happen with the original state
@@ -561,8 +564,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
561
564
} ,
562
565
) ;
563
566
564
- let ( _, certainty, instantiate_goals) =
565
- self . evaluate_goal ( IsNormalizesToHack :: Yes , unconstrained_goal) ?;
567
+ let ( _, certainty, instantiate_goals) = self . evaluate_goal (
568
+ GoalEvaluationKind :: Nested { is_normalizes_to_hack : IsNormalizesToHack :: Yes } ,
569
+ unconstrained_goal,
570
+ ) ?;
566
571
self . add_goals ( instantiate_goals) ;
567
572
568
573
// Finally, equate the goal's RHS with the unconstrained var.
@@ -596,8 +601,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
596
601
}
597
602
598
603
for goal in goals. goals . drain ( ..) {
599
- let ( has_changed, certainty, instantiate_goals) =
600
- self . evaluate_goal ( IsNormalizesToHack :: No , goal) ?;
604
+ let ( has_changed, certainty, instantiate_goals) = self . evaluate_goal (
605
+ GoalEvaluationKind :: Nested { is_normalizes_to_hack : IsNormalizesToHack :: No } ,
606
+ goal,
607
+ ) ?;
601
608
self . add_goals ( instantiate_goals) ;
602
609
if has_changed {
603
610
unchanged_certainty = None ;
0 commit comments