@@ -7,6 +7,7 @@ use rustc_infer::infer::{
77 BoundRegionConversionTime , DefineOpaqueTypes , InferCtxt , InferOk , TyCtxtInferExt ,
88} ;
99use rustc_infer:: traits:: query:: NoSolution ;
10+ use rustc_infer:: traits:: solve:: MaybeCause ;
1011use rustc_infer:: traits:: ObligationCause ;
1112use rustc_middle:: infer:: canonical:: CanonicalVarInfos ;
1213use rustc_middle:: infer:: unify_key:: { ConstVariableOrigin , ConstVariableOriginKind } ;
@@ -29,7 +30,7 @@ use std::ops::ControlFlow;
2930use crate :: traits:: vtable:: { count_own_vtable_entries, prepare_vtable_segments, VtblSegment } ;
3031
3132use super :: inspect:: ProofTreeBuilder ;
32- use super :: { search_graph, GoalEvaluationKind } ;
33+ use super :: { search_graph, GoalEvaluationKind , FIXPOINT_STEP_LIMIT } ;
3334use super :: { search_graph:: SearchGraph , Goal } ;
3435use super :: { GoalSource , SolverMode } ;
3536pub use select:: InferCtxtSelectExt ;
@@ -154,10 +155,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
154155 self . search_graph . solver_mode ( )
155156 }
156157
157- pub ( super ) fn local_overflow_limit ( & self ) -> usize {
158- self . search_graph . local_overflow_limit ( )
159- }
160-
161158 /// Creates a root evaluation context and search graph. This should only be
162159 /// used from outside of any evaluation, and other methods should be preferred
163160 /// over using this manually (such as [`InferCtxtEvalExt::evaluate_root_goal`]).
@@ -167,7 +164,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
167164 f : impl FnOnce ( & mut EvalCtxt < ' _ , ' tcx > ) -> R ,
168165 ) -> ( R , Option < inspect:: GoalEvaluation < ' tcx > > ) {
169166 let mode = if infcx. intercrate { SolverMode :: Coherence } else { SolverMode :: Normal } ;
170- let mut search_graph = search_graph:: SearchGraph :: new ( infcx . tcx , mode) ;
167+ let mut search_graph = search_graph:: SearchGraph :: new ( mode) ;
171168
172169 let mut ecx = EvalCtxt {
173170 search_graph : & mut search_graph,
@@ -388,16 +385,18 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
388385 && source != GoalSource :: ImplWhereBound
389386 } ;
390387
391- if response. value . certainty == Certainty :: OVERFLOW && !keep_overflow_constraints ( ) {
392- ( Certainty :: OVERFLOW , false )
393- } else {
394- let has_changed = !response. value . var_values . is_identity_modulo_regions ( )
395- || !response. value . external_constraints . opaque_types . is_empty ( ) ;
396-
397- let certainty =
398- self . instantiate_and_apply_query_response ( param_env, original_values, response) ;
399- ( certainty, has_changed)
388+ if let Certainty :: Maybe ( MaybeCause :: Overflow { .. } ) = response. value . certainty
389+ && !keep_overflow_constraints ( )
390+ {
391+ return ( response. value . certainty , false ) ;
400392 }
393+
394+ let has_changed = !response. value . var_values . is_identity_modulo_regions ( )
395+ || !response. value . external_constraints . opaque_types . is_empty ( ) ;
396+
397+ let certainty =
398+ self . instantiate_and_apply_query_response ( param_env, original_values, response) ;
399+ ( certainty, has_changed)
401400 }
402401
403402 fn compute_goal ( & mut self , goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ) -> QueryResult < ' tcx > {
@@ -466,8 +465,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
466465 let inspect = self . inspect . new_evaluate_added_goals ( ) ;
467466 let inspect = core:: mem:: replace ( & mut self . inspect , inspect) ;
468467
469- let mut response = Ok ( Certainty :: OVERFLOW ) ;
470- for _ in 0 ..self . local_overflow_limit ( ) {
468+ let mut response = Ok ( Certainty :: overflow ( false ) ) ;
469+ for _ in 0 ..FIXPOINT_STEP_LIMIT {
471470 // FIXME: This match is a bit ugly, it might be nice to change the inspect
472471 // stuff to use a closure instead. which should hopefully simplify this a bit.
473472 match self . evaluate_added_goals_step ( ) {
0 commit comments