mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Rollup merge of #72517 - lcnr:refactor-winnowing, r=jonas-schievink
small select cleanup
This commit is contained in:
commit
6cb1c0eb64
@ -1058,20 +1058,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
// Heuristics: show the diagnostics when there are no candidates in crate.
|
// Heuristics: show the diagnostics when there are no candidates in crate.
|
||||||
if let Ok(candidate_set) = self.assemble_candidates(stack) {
|
if let Ok(candidate_set) = self.assemble_candidates(stack) {
|
||||||
let mut no_candidates_apply = true;
|
let mut no_candidates_apply = true;
|
||||||
{
|
|
||||||
let evaluated_candidates =
|
|
||||||
candidate_set.vec.iter().map(|c| self.evaluate_candidate(stack, &c));
|
|
||||||
|
|
||||||
for ec in evaluated_candidates {
|
for c in candidate_set.vec.iter() {
|
||||||
match ec {
|
if self.evaluate_candidate(stack, &c)?.may_apply() {
|
||||||
Ok(c) => {
|
no_candidates_apply = false;
|
||||||
if c.may_apply() {
|
break;
|
||||||
no_candidates_apply = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(e) => return Err(e.into()),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3182,11 +3173,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||||||
assert_eq!(tys_a.len(), tys_b.len());
|
assert_eq!(tys_a.len(), tys_b.len());
|
||||||
|
|
||||||
// The last field of the tuple has to exist.
|
// The last field of the tuple has to exist.
|
||||||
let (&a_last, a_mid) = if let Some(x) = tys_a.split_last() {
|
let (&a_last, a_mid) = tys_a.split_last().ok_or(Unimplemented)?;
|
||||||
x
|
|
||||||
} else {
|
|
||||||
return Err(Unimplemented);
|
|
||||||
};
|
|
||||||
let &b_last = tys_b.last().unwrap();
|
let &b_last = tys_b.last().unwrap();
|
||||||
|
|
||||||
// Check that the source tuple with the target's
|
// Check that the source tuple with the target's
|
||||||
|
Loading…
Reference in New Issue
Block a user