@@ -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;
@@ -157,10 +158,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
157158 self.search_graph.solver_mode()
158159 }
159160
160- pub(super) fn local_overflow_limit(&self) -> usize {
161- self.search_graph.local_overflow_limit()
162- }
163-
164161 /// Creates a root evaluation context and search graph. This should only be
165162 /// used from outside of any evaluation, and other methods should be preferred
166163 /// over using this manually (such as [`InferCtxtEvalExt::evaluate_root_goal`]).
@@ -170,7 +167,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
170167 f: impl FnOnce(&mut EvalCtxt<'_, 'tcx>) -> R,
171168 ) -> (R, Option<inspect::GoalEvaluation<'tcx>>) {
172169 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);
174171
175172 let mut ecx = EvalCtxt {
176173 search_graph: &mut search_graph,
@@ -404,16 +401,18 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
404401 && source != GoalSource::ImplWhereBound
405402 };
406403
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()));
416408 }
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))
417416 }
418417
419418 fn compute_goal(&mut self, goal: Goal<'tcx, ty::Predicate<'tcx>>) -> QueryResult<'tcx> {
@@ -482,8 +481,8 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
482481 let inspect = self.inspect.new_evaluate_added_goals();
483482 let inspect = core::mem::replace(&mut self.inspect, inspect);
484483
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 {
487486 // FIXME: This match is a bit ugly, it might be nice to change the inspect
488487 // stuff to use a closure instead. which should hopefully simplify this a bit.
489488 match self.evaluate_added_goals_step() {
0 commit comments