@@ -333,7 +333,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
333333 let ( orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
334334 let mut goal_evaluation =
335335 self . inspect . new_goal_evaluation ( goal, & orig_values, goal_evaluation_kind) ;
336- let encountered_overflow = self . search_graph . encountered_overflow ( ) ;
337336 let canonical_response = EvalCtxt :: evaluate_canonical_goal (
338337 self . tcx ( ) ,
339338 self . search_graph ,
@@ -368,75 +367,19 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
368367 bug ! ( "an unchanged goal shouldn't have any side-effects on instantiation" ) ;
369368 }
370369
371- // Check that rerunning this query with its inference constraints applied
372- // doesn't result in new inference constraints and has the same result .
370+ // FIXME: We previously had an assert here that checked that recomputing
371+ // a goal after applying its constraints did not change its response .
373372 //
374- // If we have projection goals like `<T as Trait>::Assoc == u32` we recursively
375- // call `exists<U> <T as Trait>::Assoc == U` to enable better caching. This goal
376- // could constrain `U` to `u32` which would cause this check to result in a
377- // solver cycle.
378- if cfg ! ( debug_assertions)
379- && has_changed
380- && !matches ! (
381- goal_evaluation_kind,
382- GoalEvaluationKind :: Nested { is_normalizes_to_hack: IsNormalizesToHack :: Yes }
383- )
384- && !self . search_graph . in_cycle ( )
385- {
386- // The nested evaluation has to happen with the original state
387- // of `encountered_overflow`.
388- let from_original_evaluation =
389- self . search_graph . reset_encountered_overflow ( encountered_overflow) ;
390- self . check_evaluate_goal_stable_result ( goal, canonical_goal, canonical_response) ;
391- // In case the evaluation was unstable, we manually make sure that this
392- // debug check does not influence the result of the parent goal.
393- self . search_graph . reset_encountered_overflow ( from_original_evaluation) ;
394- }
373+ // This assert was removed as it did not hold for goals constraining
374+ // an inference variable to a recursive alias, e.g. in
375+ // tests/ui/traits/new-solver/overflow/recursive-self-normalization.rs.
376+ //
377+ // Once we have decided on how to handle trait-system-refactor-initiative#75,
378+ // we should re-add an assert here.
395379
396380 Ok ( ( has_changed, certainty, nested_goals) )
397381 }
398382
399- fn check_evaluate_goal_stable_result (
400- & mut self ,
401- goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
402- original_input : CanonicalInput < ' tcx > ,
403- original_result : CanonicalResponse < ' tcx > ,
404- ) {
405- let ( _orig_values, canonical_goal) = self . canonicalize_goal ( goal) ;
406- let result = EvalCtxt :: evaluate_canonical_goal (
407- self . tcx ( ) ,
408- self . search_graph ,
409- canonical_goal,
410- // FIXME(-Ztrait-solver=next): we do not track what happens in `evaluate_canonical_goal`
411- & mut ProofTreeBuilder :: new_noop ( ) ,
412- ) ;
413-
414- macro_rules! fail {
415- ( $msg: expr) => { {
416- let msg = $msg;
417- warn!(
418- "unstable result: {msg}\n \
419- original goal: {original_input:?},\n \
420- original result: {original_result:?}\n \
421- re-canonicalized goal: {canonical_goal:?}\n \
422- second response: {result:?}"
423- ) ;
424- return ;
425- } } ;
426- }
427-
428- let Ok ( new_canonical_response) = result else { fail ! ( "second response was error" ) } ;
429- // We only check for modulo regions as we convert all regions in
430- // the input to new existentials, even if they're expected to be
431- // `'static` or a placeholder region.
432- if !new_canonical_response. value . var_values . is_identity_modulo_regions ( ) {
433- fail ! ( "additional constraints from second response" )
434- }
435- if original_result. value . certainty != new_canonical_response. value . certainty {
436- fail ! ( "unstable certainty" )
437- }
438- }
439-
440383 fn compute_goal ( & mut self , goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ) -> QueryResult < ' tcx > {
441384 let Goal { param_env, predicate } = goal;
442385 let kind = predicate. kind ( ) ;
0 commit comments