@@ -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 ;
@@ -154,10 +155,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
154
155
self . search_graph . solver_mode ( )
155
156
}
156
157
157
- pub ( super ) fn local_overflow_limit ( & self ) -> usize {
158
- self . search_graph . local_overflow_limit ( )
159
- }
160
-
161
158
/// Creates a root evaluation context and search graph. This should only be
162
159
/// used from outside of any evaluation, and other methods should be preferred
163
160
/// over using this manually (such as [`InferCtxtEvalExt::evaluate_root_goal`]).
@@ -167,7 +164,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
167
164
f : impl FnOnce ( & mut EvalCtxt < ' _ , ' tcx > ) -> R ,
168
165
) -> ( R , Option < inspect:: GoalEvaluation < ' tcx > > ) {
169
166
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) ;
171
168
172
169
let mut ecx = EvalCtxt {
173
170
search_graph : & mut search_graph,
@@ -388,16 +385,18 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
388
385
&& source != GoalSource :: ImplWhereBound
389
386
} ;
390
387
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 ) ;
400
392
}
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)
401
400
}
402
401
403
402
fn compute_goal ( & mut self , goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ) -> QueryResult < ' tcx > {
@@ -466,8 +465,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
466
465
let inspect = self . inspect . new_evaluate_added_goals ( ) ;
467
466
let inspect = core:: mem:: replace ( & mut self . inspect , inspect) ;
468
467
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 {
471
470
// FIXME: This match is a bit ugly, it might be nice to change the inspect
472
471
// stuff to use a closure instead. which should hopefully simplify this a bit.
473
472
match self . evaluate_added_goals_step ( ) {
0 commit comments