@@ -45,7 +45,7 @@ mod trait_goals;
4545pub use eval_ctxt:: EvalCtxt ;
4646pub use fulfill:: FulfillmentCtxt ;
4747
48- use self :: eval_ctxt:: NestedGoals ;
48+ use self :: eval_ctxt:: { IsNormalizesToHack , NestedGoals } ;
4949
5050trait CanonicalResponseExt {
5151 fn has_no_inference_or_external_constraints ( & self ) -> bool ;
@@ -86,7 +86,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
8686 var_values : CanonicalVarValues :: dummy ( ) ,
8787 nested_goals : NestedGoals :: new ( ) ,
8888 }
89- . evaluate_goal ( false , goal) ;
89+ . evaluate_goal ( IsNormalizesToHack :: No , goal) ;
9090
9191 assert ! ( search_graph. is_empty( ) ) ;
9292 result
@@ -130,7 +130,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
130130 /// been constrained and the certainty of the result.
131131 fn evaluate_goal (
132132 & mut self ,
133- is_projection_eq_hack_goal : bool ,
133+ is_normalizes_to_hack : IsNormalizesToHack ,
134134 goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
135135 ) -> Result < ( bool , Certainty ) , NoSolution > {
136136 let ( orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
@@ -153,7 +153,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
153153 // solver cycle.
154154 if cfg ! ( debug_assertions)
155155 && has_changed
156- && !is_projection_eq_hack_goal
156+ && is_normalizes_to_hack == IsNormalizesToHack :: No
157157 && !self . search_graph . in_cycle ( )
158158 {
159159 debug ! ( "rerunning goal to check result is stable" ) ;
@@ -223,11 +223,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
223223 } else {
224224 let kind = self . infcx . instantiate_binder_with_placeholders ( kind) ;
225225 let goal = goal. with ( self . tcx ( ) , ty:: Binder :: dummy ( kind) ) ;
226- // `false` is fine to use as if this were a projection goal from the hack there would not be
227- // a binder as the real projection goal that is the parent of the hack goal would have already
228- // had its binder replaced with placeholders.
229- let ( _, certainty) = self . evaluate_goal ( false , goal) ?;
230- self . evaluate_added_goals_and_make_canonical_response ( certainty)
226+ self . add_goal ( goal) ;
227+ self . evaluate_added_goals_and_make_canonical_response ( Certainty :: Yes )
231228 }
232229 }
233230
@@ -436,7 +433,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
436433
437434 if let Some ( goal) = goals. projection_eq_hack_goal . take ( ) {
438435 let ( _, certainty) = match this. evaluate_goal (
439- true ,
436+ IsNormalizesToHack :: Yes ,
440437 goal. with ( this. tcx ( ) , ty:: Binder :: dummy ( goal. predicate ) ) ,
441438 ) {
442439 Ok ( r) => r,
@@ -480,10 +477,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
480477 }
481478
482479 for nested_goal in goals. goals . drain ( ..) {
483- let ( changed, certainty) = match this. evaluate_goal ( false , nested_goal) {
484- Ok ( result) => result,
485- Err ( NoSolution ) => return Some ( Err ( NoSolution ) ) ,
486- } ;
480+ let ( changed, certainty) =
481+ match this. evaluate_goal ( IsNormalizesToHack :: No , nested_goal) {
482+ Ok ( result) => result,
483+ Err ( NoSolution ) => return Some ( Err ( NoSolution ) ) ,
484+ } ;
487485
488486 if changed {
489487 has_changed = Ok ( ( ) ) ;
0 commit comments