@@ -171,13 +171,7 @@ pub trait SolverDelegateEvalExt: SolverDelegate {
171171 & self ,
172172 goal : Goal < Self :: Interner , <Self :: Interner as Interner >:: Predicate > ,
173173 span : <Self :: Interner as Interner >:: Span ,
174- ) -> (
175- Result <
176- ( NestedNormalizationGoals < Self :: Interner > , GoalEvaluation < Self :: Interner > ) ,
177- NoSolution ,
178- > ,
179- inspect:: GoalEvaluation < Self :: Interner > ,
180- ) ;
174+ ) -> ( Result < GoalEvaluation < Self :: Interner > , NoSolution > , inspect:: GoalEvaluation < Self :: Interner > ) ;
181175}
182176
183177impl < D , I > SolverDelegateEvalExt for D
@@ -221,16 +215,13 @@ where
221215 & self ,
222216 goal : Goal < I , I :: Predicate > ,
223217 span : I :: Span ,
224- ) -> (
225- Result < ( NestedNormalizationGoals < I > , GoalEvaluation < I > ) , NoSolution > ,
226- inspect:: GoalEvaluation < I > ,
227- ) {
218+ ) -> ( Result < GoalEvaluation < I > , NoSolution > , inspect:: GoalEvaluation < I > ) {
228219 let ( result, proof_tree) = EvalCtxt :: enter_root (
229220 self ,
230221 self . cx ( ) . recursion_limit ( ) ,
231222 GenerateProofTree :: Yes ,
232223 span,
233- |ecx| ecx. evaluate_goal_raw ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal, None ) ,
224+ |ecx| ecx. evaluate_goal ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal, None ) ,
234225 ) ;
235226 ( result, proof_tree. unwrap ( ) )
236227 }
@@ -411,26 +402,6 @@ where
411402 goal : Goal < I , I :: Predicate > ,
412403 stalled_on : Option < GoalStalledOn < I > > ,
413404 ) -> Result < GoalEvaluation < I > , NoSolution > {
414- let ( normalization_nested_goals, goal_evaluation) =
415- self . evaluate_goal_raw ( goal_evaluation_kind, source, goal, stalled_on) ?;
416- assert ! ( normalization_nested_goals. is_empty( ) ) ;
417- Ok ( goal_evaluation)
418- }
419-
420- /// Recursively evaluates `goal`, returning the nested goals in case
421- /// the nested goal is a `NormalizesTo` goal.
422- ///
423- /// As all other goal kinds do not return any nested goals and
424- /// `NormalizesTo` is only used by `AliasRelate`, all other callsites
425- /// should use [`EvalCtxt::evaluate_goal`] which discards that empty
426- /// storage.
427- pub ( super ) fn evaluate_goal_raw (
428- & mut self ,
429- goal_evaluation_kind : GoalEvaluationKind ,
430- source : GoalSource ,
431- goal : Goal < I , I :: Predicate > ,
432- stalled_on : Option < GoalStalledOn < I > > ,
433- ) -> Result < ( NestedNormalizationGoals < I > , GoalEvaluation < I > ) , NoSolution > {
434405 // If we have run this goal before, and it was stalled, check that any of the goal's
435406 // args have changed. Otherwise, we don't need to re-run the goal because it'll remain
436407 // stalled, since it'll canonicalize the same way and evaluation is pure.
@@ -441,15 +412,13 @@ where
441412 . opaque_types_storage_num_entries ( )
442413 . needs_reevaluation ( stalled_on. num_opaques )
443414 {
444- return Ok ( (
445- NestedNormalizationGoals :: empty ( ) ,
446- GoalEvaluation {
447- goal,
448- certainty : Certainty :: Maybe ( stalled_on. stalled_cause ) ,
449- has_changed : HasChanged :: No ,
450- stalled_on : Some ( stalled_on) ,
451- } ,
452- ) ) ;
415+ return Ok ( GoalEvaluation {
416+ goal,
417+ certainty : Certainty :: Maybe ( stalled_on. stalled_cause ) ,
418+ has_changed : HasChanged :: No ,
419+ stalled_on : Some ( stalled_on) ,
420+ nested_goals : NestedNormalizationGoals :: empty ( ) ,
421+ } ) ;
453422 }
454423
455424 // We only care about one entry per `OpaqueTypeKey` here,
@@ -477,7 +446,7 @@ where
477446 let has_changed =
478447 if !has_only_region_constraints ( response) { HasChanged :: Yes } else { HasChanged :: No } ;
479448
480- let ( normalization_nested_goals , certainty) =
449+ let ( nested_goals , certainty) =
481450 self . instantiate_and_apply_query_response ( goal. param_env , & orig_values, response) ;
482451
483452 // FIXME: We previously had an assert here that checked that recomputing
@@ -536,10 +505,7 @@ where
536505 } ,
537506 } ;
538507
539- Ok ( (
540- normalization_nested_goals,
541- GoalEvaluation { goal, certainty, has_changed, stalled_on } ,
542- ) )
508+ Ok ( GoalEvaluation { goal, certainty, has_changed, stalled_on, nested_goals } )
543509 }
544510
545511 pub ( super ) fn compute_goal ( & mut self , goal : Goal < I , I :: Predicate > ) -> QueryResult < I > {
@@ -673,10 +639,13 @@ where
673639 let unconstrained_goal =
674640 goal. with ( cx, ty:: NormalizesTo { alias : pred. alias , term : unconstrained_rhs } ) ;
675641
676- let (
677- NestedNormalizationGoals ( nested_goals) ,
678- GoalEvaluation { goal, certainty, stalled_on, has_changed : _ } ,
679- ) = self . evaluate_goal_raw (
642+ let GoalEvaluation {
643+ goal,
644+ certainty,
645+ stalled_on,
646+ has_changed : _,
647+ nested_goals : NestedNormalizationGoals ( nested_goals) ,
648+ } = self . evaluate_goal (
680649 GoalEvaluationKind :: Nested ,
681650 source,
682651 unconstrained_goal,
@@ -733,12 +702,18 @@ where
733702 }
734703 }
735704 } else {
736- let GoalEvaluation { goal, certainty, has_changed, stalled_on } =
737- self . evaluate_goal ( GoalEvaluationKind :: Nested , source, goal, stalled_on) ?;
705+ let GoalEvaluation {
706+ goal,
707+ certainty,
708+ has_changed,
709+ stalled_on,
710+ nested_goals : NestedNormalizationGoals ( nested_goals) ,
711+ } = self . evaluate_goal ( GoalEvaluationKind :: Nested , source, goal, stalled_on) ?;
712+ trace ! ( ?nested_goals) ;
713+ self . nested_goals . extend ( nested_goals. into_iter ( ) . map ( |( s, g) | ( s, g, None ) ) ) ;
738714 if has_changed == HasChanged :: Yes {
739715 unchanged_certainty = None ;
740716 }
741-
742717 match certainty {
743718 Certainty :: Yes => { }
744719 Certainty :: Maybe ( _) => {
0 commit comments