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>,
|
obligation: &PredicateObligation<'tcx>,
|
||||||
) -> Result<EvaluationResult, OverflowError> {
|
) -> Result<EvaluationResult, OverflowError> {
|
||||||
self.evaluation_probe(|this| {
|
self.evaluation_probe(|this| {
|
||||||
if this.tcx().trait_solver_next() {
|
let goal = infcx.resolve_vars_if_possible((obligation.predicate, obligation.param_env));
|
||||||
this.evaluate_predicates_recursively_in_new_solver([obligation.clone()])
|
let mut result = if this.tcx().trait_solver_next() {
|
||||||
|
this.evaluate_predicates_recursively_in_new_solver([obligation.clone()])?
|
||||||
} else {
|
} else {
|
||||||
this.evaluate_predicate_recursively(
|
this.evaluate_predicate_recursively(
|
||||||
TraitObligationStackList::empty(&ProvisionalEvaluationCache::default()),
|
TraitObligationStackList::empty(&ProvisionalEvaluationCache::default()),
|
||||||
obligation.clone(),
|
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