1
Fork 0

do not constrain infer vars in find_best_leaf_obligation

This commit is contained in:
lcnr 2024-11-26 11:44:23 +01:00
parent f2abf827c1
commit d25ecfd5d6
10 changed files with 25 additions and 123 deletions

View file

@ -346,12 +346,21 @@ fn find_best_leaf_obligation<'tcx>(
consider_ambiguities: bool,
) -> PredicateObligation<'tcx> {
let obligation = infcx.resolve_vars_if_possible(obligation.clone());
// FIXME: we use a probe here as the `BestObligation` visitor does not
// check whether it uses candidates which get shadowed by where-bounds.
//
// We should probably fix the visitor to not do so instead, as this also
// means the leaf obligation may be incorrect.
infcx
.visit_proof_tree(obligation.clone().into(), &mut BestObligation {
obligation: obligation.clone(),
consider_ambiguities,
.fudge_inference_if_ok(|| {
infcx
.visit_proof_tree(obligation.clone().into(), &mut BestObligation {
obligation: obligation.clone(),
consider_ambiguities,
})
.break_value()
.ok_or(())
})
.break_value()
.unwrap_or(obligation)
}