@@ -45,7 +45,7 @@ mod trait_goals;
45
45
pub use eval_ctxt:: EvalCtxt ;
46
46
pub use fulfill:: FulfillmentCtxt ;
47
47
48
- use self :: eval_ctxt:: NestedGoals ;
48
+ use self :: eval_ctxt:: { IsNormalizesToHack , NestedGoals } ;
49
49
50
50
trait CanonicalResponseExt {
51
51
fn has_no_inference_or_external_constraints ( & self ) -> bool ;
@@ -86,7 +86,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
86
86
var_values : CanonicalVarValues :: dummy ( ) ,
87
87
nested_goals : NestedGoals :: new ( ) ,
88
88
}
89
- . evaluate_goal ( false , goal) ;
89
+ . evaluate_goal ( IsNormalizesToHack :: No , goal) ;
90
90
91
91
assert ! ( search_graph. is_empty( ) ) ;
92
92
result
@@ -130,7 +130,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
130
130
/// been constrained and the certainty of the result.
131
131
fn evaluate_goal (
132
132
& mut self ,
133
- is_projection_eq_hack_goal : bool ,
133
+ is_normalizes_to_hack : IsNormalizesToHack ,
134
134
goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
135
135
) -> Result < ( bool , Certainty ) , NoSolution > {
136
136
let ( orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
@@ -153,7 +153,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
153
153
// solver cycle.
154
154
if cfg ! ( debug_assertions)
155
155
&& has_changed
156
- && !is_projection_eq_hack_goal
156
+ && is_normalizes_to_hack == IsNormalizesToHack :: No
157
157
&& !self . search_graph . in_cycle ( )
158
158
{
159
159
debug ! ( "rerunning goal to check result is stable" ) ;
@@ -223,11 +223,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
223
223
} else {
224
224
let kind = self . infcx . instantiate_binder_with_placeholders ( kind) ;
225
225
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 )
231
228
}
232
229
}
233
230
@@ -436,7 +433,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
436
433
437
434
if let Some ( goal) = goals. projection_eq_hack_goal . take ( ) {
438
435
let ( _, certainty) = match this. evaluate_goal (
439
- true ,
436
+ IsNormalizesToHack :: Yes ,
440
437
goal. with ( this. tcx ( ) , ty:: Binder :: dummy ( goal. predicate ) ) ,
441
438
) {
442
439
Ok ( r) => r,
@@ -480,10 +477,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
480
477
}
481
478
482
479
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
+ } ;
487
485
488
486
if changed {
489
487
has_changed = Ok ( ( ) ) ;
0 commit comments