@@ -7,6 +7,7 @@ use rustc_infer::infer::{
7
7
BoundRegionConversionTime , DefineOpaqueTypes , InferCtxt , InferOk , TyCtxtInferExt ,
8
8
} ;
9
9
use rustc_infer:: traits:: query:: NoSolution ;
10
+ use rustc_infer:: traits:: solve:: MaybeCause ;
10
11
use rustc_infer:: traits:: ObligationCause ;
11
12
use rustc_middle:: infer:: canonical:: CanonicalVarInfos ;
12
13
use rustc_middle:: infer:: unify_key:: { ConstVariableOrigin , ConstVariableOriginKind } ;
@@ -29,7 +30,7 @@ use std::ops::ControlFlow;
29
30
use crate :: traits:: vtable:: { count_own_vtable_entries, prepare_vtable_segments, VtblSegment } ;
30
31
31
32
use super :: inspect:: ProofTreeBuilder ;
32
- use super :: { search_graph, GoalEvaluationKind } ;
33
+ use super :: { search_graph, GoalEvaluationKind , FIXPOINT_STEP_LIMIT } ;
33
34
use super :: { search_graph:: SearchGraph , Goal } ;
34
35
use super :: { GoalSource , SolverMode } ;
35
36
pub use select:: InferCtxtSelectExt ;
@@ -157,10 +158,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
157
158
self . search_graph . solver_mode ( )
158
159
}
159
160
160
- pub ( super ) fn local_overflow_limit ( & self ) -> usize {
161
- self . search_graph . local_overflow_limit ( )
162
- }
163
-
164
161
/// Creates a root evaluation context and search graph. This should only be
165
162
/// used from outside of any evaluation, and other methods should be preferred
166
163
/// over using this manually (such as [`InferCtxtEvalExt::evaluate_root_goal`]).
@@ -170,7 +167,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
170
167
f : impl FnOnce ( & mut EvalCtxt < ' _ , ' tcx > ) -> R ,
171
168
) -> ( R , Option < inspect:: GoalEvaluation < ' tcx > > ) {
172
169
let mode = if infcx. intercrate { SolverMode :: Coherence } else { SolverMode :: Normal } ;
173
- let mut search_graph = search_graph:: SearchGraph :: new ( infcx . tcx , mode) ;
170
+ let mut search_graph = search_graph:: SearchGraph :: new ( mode) ;
174
171
175
172
let mut ecx = EvalCtxt {
176
173
search_graph : & mut search_graph,
@@ -404,16 +401,18 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
404
401
&& source != GoalSource :: ImplWhereBound
405
402
} ;
406
403
407
- if response. value . certainty == Certainty :: OVERFLOW && !keep_overflow_constraints ( ) {
408
- Ok ( ( Certainty :: OVERFLOW , false , Vec :: new ( ) ) )
409
- } else {
410
- let has_changed = !response. value . var_values . is_identity_modulo_regions ( )
411
- || !response. value . external_constraints . opaque_types . is_empty ( ) ;
412
-
413
- let ( certainty, nested_goals) =
414
- self . instantiate_and_apply_query_response ( param_env, original_values, response) ?;
415
- Ok ( ( certainty, has_changed, nested_goals) )
404
+ if let Certainty :: Maybe ( MaybeCause :: Overflow { .. } ) = response. value . certainty
405
+ && !keep_overflow_constraints ( )
406
+ {
407
+ return Ok ( ( response. value . certainty , false , Vec :: new ( ) ) ) ;
416
408
}
409
+
410
+ let has_changed = !response. value . var_values . is_identity_modulo_regions ( )
411
+ || !response. value . external_constraints . opaque_types . is_empty ( ) ;
412
+
413
+ let ( certainty, nested_goals) =
414
+ self . instantiate_and_apply_query_response ( param_env, original_values, response) ?;
415
+ Ok ( ( certainty, has_changed, nested_goals) )
417
416
}
418
417
419
418
fn compute_goal ( & mut self , goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ) -> QueryResult < ' tcx > {
@@ -482,8 +481,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
482
481
let inspect = self . inspect . new_evaluate_added_goals ( ) ;
483
482
let inspect = core:: mem:: replace ( & mut self . inspect , inspect) ;
484
483
485
- let mut response = Ok ( Certainty :: OVERFLOW ) ;
486
- for _ in 0 ..self . local_overflow_limit ( ) {
484
+ let mut response = Ok ( Certainty :: overflow ( false ) ) ;
485
+ for _ in 0 ..FIXPOINT_STEP_LIMIT {
487
486
// FIXME: This match is a bit ugly, it might be nice to change the inspect
488
487
// stuff to use a closure instead. which should hopefully simplify this a bit.
489
488
match self . evaluate_added_goals_step ( ) {
0 commit comments