Skip to content

Commit fe935d1

Browse files
authored
Unrolled build for rust-lang#121520
Rollup merge of rust-lang#121520 - matthiaskrgr:cloned, r=jackh726 delay cloning of iterator items
2 parents 6bdb8a4 + 62cb9d1 commit fe935d1

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -320,22 +320,25 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
320320
let mut errors = fulfill_cx.select_where_possible(infcx);
321321
errors.pop().map(|err| err.obligation)
322322
} else {
323-
obligations.iter().cloned().find(|obligation| {
324-
// We use `evaluate_root_obligation` to correctly track intercrate
325-
// ambiguity clauses. We cannot use this in the new solver.
326-
let evaluation_result = selcx.evaluate_root_obligation(obligation);
327-
328-
match evaluation_result {
329-
Ok(result) => !result.may_apply(),
330-
// If overflow occurs, we need to conservatively treat the goal as possibly holding,
331-
// since there can be instantiations of this goal that don't overflow and result in
332-
// success. This isn't much of a problem in the old solver, since we treat overflow
333-
// fatally (this still can be encountered: <https://github.com/rust-lang/rust/issues/105231>),
334-
// but in the new solver, this is very important for correctness, since overflow
335-
// *must* be treated as ambiguity for completeness.
336-
Err(_overflow) => false,
337-
}
338-
})
323+
obligations
324+
.iter()
325+
.find(|obligation| {
326+
// We use `evaluate_root_obligation` to correctly track intercrate
327+
// ambiguity clauses. We cannot use this in the new solver.
328+
let evaluation_result = selcx.evaluate_root_obligation(obligation);
329+
330+
match evaluation_result {
331+
Ok(result) => !result.may_apply(),
332+
// If overflow occurs, we need to conservatively treat the goal as possibly holding,
333+
// since there can be instantiations of this goal that don't overflow and result in
334+
// success. This isn't much of a problem in the old solver, since we treat overflow
335+
// fatally (this still can be encountered: <https://github.com/rust-lang/rust/issues/105231>),
336+
// but in the new solver, this is very important for correctness, since overflow
337+
// *must* be treated as ambiguity for completeness.
338+
Err(_overflow) => false,
339+
}
340+
})
341+
.cloned()
339342
}
340343
}
341344

0 commit comments

Comments
 (0)