EvaluateToAmbig if evaluate_root_obligation does inference
This commit is contained in:
parent
077fc26f0a
commit
dbbb42442c
@ -537,14 +537,21 @@ pub fn evaluate_root_obligation(
|
||||
obligation: &PredicateObligation<'tcx>,
|
||||
) -> Result<EvaluationResult, OverflowError> {
|
||||
self.evaluation_probe(|this| {
|
||||
if this.tcx().trait_solver_next() {
|
||||
this.evaluate_predicates_recursively_in_new_solver([obligation.clone()])
|
||||
let goal = infcx.resolve_vars_if_possible((obligation.predicate, obligation.param_env));
|
||||
let mut result = if this.tcx().trait_solver_next() {
|
||||
this.evaluate_predicates_recursively_in_new_solver([obligation.clone()])?
|
||||
} else {
|
||||
this.evaluate_predicate_recursively(
|
||||
TraitObligationStackList::empty(&ProvisionalEvaluationCache::default()),
|
||||
obligation.clone(),
|
||||
)
|
||||
)?
|
||||
};
|
||||
// If the predicate has done any inference, then downgrade the
|
||||
// result to ambiguous.
|
||||
if this.infcx.shallow_resolve(goal) != goal {
|
||||
result = result.max(EvaluatedToAmbig);
|
||||
}
|
||||
Ok(result)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user