Rollup merge of #129078 - lcnr:scrape_region_constraints-use-ocx, r=compiler-errors
`ParamEnvAnd::fully_perform`: we have an `ocx`, use it cc #123669 r? ``@compiler-errors``
This commit is contained in:
commit
4f46643698
@ -168,44 +168,12 @@ fn fully_perform(
|
|||||||
// collecting region constraints via `region_constraints`.
|
// collecting region constraints via `region_constraints`.
|
||||||
let (mut output, _) = scrape_region_constraints(
|
let (mut output, _) = scrape_region_constraints(
|
||||||
infcx,
|
infcx,
|
||||||
|_ocx| {
|
|ocx| {
|
||||||
let (output, ei, mut obligations, _) =
|
let (output, ei, obligations, _) =
|
||||||
Q::fully_perform_into(self, infcx, &mut region_constraints, span)?;
|
Q::fully_perform_into(self, infcx, &mut region_constraints, span)?;
|
||||||
error_info = ei;
|
error_info = ei;
|
||||||
|
|
||||||
// Typically, instantiating NLL query results does not
|
ocx.register_obligations(obligations);
|
||||||
// create obligations. However, in some cases there
|
|
||||||
// are unresolved type variables, and unify them *can*
|
|
||||||
// create obligations. In that case, we have to go
|
|
||||||
// fulfill them. We do this via a (recursive) query.
|
|
||||||
while !obligations.is_empty() {
|
|
||||||
trace!("{:#?}", obligations);
|
|
||||||
let mut progress = false;
|
|
||||||
for obligation in std::mem::take(&mut obligations) {
|
|
||||||
let obligation = infcx.resolve_vars_if_possible(obligation);
|
|
||||||
match ProvePredicate::fully_perform_into(
|
|
||||||
obligation.param_env.and(ProvePredicate::new(obligation.predicate)),
|
|
||||||
infcx,
|
|
||||||
&mut region_constraints,
|
|
||||||
span,
|
|
||||||
) {
|
|
||||||
Ok(((), _, new, certainty)) => {
|
|
||||||
obligations.extend(new);
|
|
||||||
progress = true;
|
|
||||||
if let Certainty::Ambiguous = certainty {
|
|
||||||
obligations.push(obligation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(_) => obligations.push(obligation),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !progress {
|
|
||||||
infcx.dcx().span_bug(
|
|
||||||
span,
|
|
||||||
format!("ambiguity processing {obligations:?} from {self:?}"),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(output)
|
Ok(output)
|
||||||
},
|
},
|
||||||
"fully_perform",
|
"fully_perform",
|
||||||
|
Loading…
Reference in New Issue
Block a user