@@ -28,8 +28,8 @@ use std::ops::ControlFlow;
2828use crate :: traits:: vtable:: { count_own_vtable_entries, prepare_vtable_segments, VtblSegment } ;
2929
3030use super :: inspect:: ProofTreeBuilder ;
31- use super :: search_graph;
3231use super :: SolverMode ;
32+ use super :: { search_graph, GoalEvaluationKind } ;
3333use super :: { search_graph:: SearchGraph , Goal } ;
3434pub use select:: InferCtxtSelectExt ;
3535
@@ -85,7 +85,7 @@ pub struct EvalCtxt<'a, 'tcx> {
8585 // evaluation code.
8686 tainted : Result < ( ) , NoSolution > ,
8787
88- inspect : ProofTreeBuilder < ' tcx > ,
88+ pub ( super ) inspect : ProofTreeBuilder < ' tcx > ,
8989}
9090
9191#[ derive( Debug , Clone ) ]
@@ -164,7 +164,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
164164 Option < inspect:: GoalEvaluation < ' tcx > > ,
165165 ) {
166166 EvalCtxt :: enter_root ( self , generate_proof_tree, |ecx| {
167- ecx. evaluate_goal ( IsNormalizesToHack :: No , goal)
167+ ecx. evaluate_goal ( GoalEvaluationKind :: Root , goal)
168168 } )
169169 }
170170}
@@ -340,11 +340,11 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
340340 /// been constrained and the certainty of the result.
341341 fn evaluate_goal (
342342 & mut self ,
343- is_normalizes_to_hack : IsNormalizesToHack ,
343+ goal_evaluation_kind : GoalEvaluationKind ,
344344 goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
345345 ) -> Result < ( bool , Certainty , Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ) , NoSolution > {
346346 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 ) ;
348348 let encountered_overflow = self . search_graph . encountered_overflow ( ) ;
349349 let canonical_response = EvalCtxt :: evaluate_canonical_goal (
350350 self . tcx ( ) ,
@@ -389,7 +389,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
389389 // solver cycle.
390390 if cfg ! ( debug_assertions)
391391 && 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+ )
393396 && !self . search_graph . in_cycle ( )
394397 {
395398 // The nested evaluation has to happen with the original state
@@ -561,8 +564,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
561564 } ,
562565 ) ;
563566
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+ ) ?;
566571 self . add_goals ( instantiate_goals) ;
567572
568573 // Finally, equate the goal's RHS with the unconstrained var.
@@ -596,8 +601,10 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
596601 }
597602
598603 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+ ) ?;
601608 self . add_goals ( instantiate_goals) ;
602609 if has_changed {
603610 unchanged_certainty = None ;
0 commit comments