delay cloning of iterator items
This commit is contained in:
parent
b6a23b8537
commit
62cb9d1a97
1 changed files with 18 additions and 15 deletions
|
@ -320,22 +320,25 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
|
||||||
let mut errors = fulfill_cx.select_where_possible(infcx);
|
let mut errors = fulfill_cx.select_where_possible(infcx);
|
||||||
errors.pop().map(|err| err.obligation)
|
errors.pop().map(|err| err.obligation)
|
||||||
} else {
|
} else {
|
||||||
obligations.iter().cloned().find(|obligation| {
|
obligations
|
||||||
// We use `evaluate_root_obligation` to correctly track intercrate
|
.iter()
|
||||||
// ambiguity clauses. We cannot use this in the new solver.
|
.find(|obligation| {
|
||||||
let evaluation_result = selcx.evaluate_root_obligation(obligation);
|
// We use `evaluate_root_obligation` to correctly track intercrate
|
||||||
|
// ambiguity clauses. We cannot use this in the new solver.
|
||||||
|
let evaluation_result = selcx.evaluate_root_obligation(obligation);
|
||||||
|
|
||||||
match evaluation_result {
|
match evaluation_result {
|
||||||
Ok(result) => !result.may_apply(),
|
Ok(result) => !result.may_apply(),
|
||||||
// If overflow occurs, we need to conservatively treat the goal as possibly holding,
|
// If overflow occurs, we need to conservatively treat the goal as possibly holding,
|
||||||
// since there can be instantiations of this goal that don't overflow and result in
|
// since there can be instantiations of this goal that don't overflow and result in
|
||||||
// success. This isn't much of a problem in the old solver, since we treat overflow
|
// success. This isn't much of a problem in the old solver, since we treat overflow
|
||||||
// fatally (this still can be encountered: <https://github.com/rust-lang/rust/issues/105231>),
|
// fatally (this still can be encountered: <https://github.com/rust-lang/rust/issues/105231>),
|
||||||
// but in the new solver, this is very important for correctness, since overflow
|
// but in the new solver, this is very important for correctness, since overflow
|
||||||
// *must* be treated as ambiguity for completeness.
|
// *must* be treated as ambiguity for completeness.
|
||||||
Err(_overflow) => false,
|
Err(_overflow) => false,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.cloned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue