Rollup merge of #133493 - lcnr:fulfill-fudge, r=compiler-errors
do not constrain infer vars in `find_best_leaf_obligation`
This ended up causing an ICE by making the following code path reachable by incorrectly constraining an inference variable while computing the best obligation for a preceding ambiguity. Closes #129444.
f2abf827c1/compiler/rustc_trait_selection/src/solve/fulfill.rs (L312-L314)
I have to be honest, I don't fully understand how that change removes all the additional diagnostics :3
r? `@compiler-errors`
This commit is contained in:
commit
762a661705
13 changed files with 114 additions and 138 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue