Skip to content

Commit 4f46643

Browse files
Rollup merge of rust-lang#129078 - lcnr:scrape_region_constraints-use-ocx, r=compiler-errors
`ParamEnvAnd::fully_perform`: we have an `ocx`, use it cc rust-lang#123669 r? ``@compiler-errors``
2 parents eb6ecf1 + 3a02047 commit 4f46643

File tree

1 file changed

+3
-35
lines changed
  • compiler/rustc_trait_selection/src/traits/query/type_op

1 file changed

+3
-35
lines changed

Diff for: compiler/rustc_trait_selection/src/traits/query/type_op/mod.rs

+3-35
Original file line numberDiff line numberDiff line change
@@ -168,44 +168,12 @@ where
168168
// collecting region constraints via `region_constraints`.
169169
let (mut output, _) = scrape_region_constraints(
170170
infcx,
171-
|_ocx| {
172-
let (output, ei, mut obligations, _) =
171+
|ocx| {
172+
let (output, ei, obligations, _) =
173173
Q::fully_perform_into(self, infcx, &mut region_constraints, span)?;
174174
error_info = ei;
175175

176-
// Typically, instantiating NLL query results does not
177-
// create obligations. However, in some cases there
178-
// are unresolved type variables, and unify them *can*
179-
// create obligations. In that case, we have to go
180-
// fulfill them. We do this via a (recursive) query.
181-
while !obligations.is_empty() {
182-
trace!("{:#?}", obligations);
183-
let mut progress = false;
184-
for obligation in std::mem::take(&mut obligations) {
185-
let obligation = infcx.resolve_vars_if_possible(obligation);
186-
match ProvePredicate::fully_perform_into(
187-
obligation.param_env.and(ProvePredicate::new(obligation.predicate)),
188-
infcx,
189-
&mut region_constraints,
190-
span,
191-
) {
192-
Ok(((), _, new, certainty)) => {
193-
obligations.extend(new);
194-
progress = true;
195-
if let Certainty::Ambiguous = certainty {
196-
obligations.push(obligation);
197-
}
198-
}
199-
Err(_) => obligations.push(obligation),
200-
}
201-
}
202-
if !progress {
203-
infcx.dcx().span_bug(
204-
span,
205-
format!("ambiguity processing {obligations:?} from {self:?}"),
206-
);
207-
}
208-
}
176+
ocx.register_obligations(obligations);
209177
Ok(output)
210178
},
211179
"fully_perform",

0 commit comments

Comments
 (0)