Tweak the function boundary
This commit is contained in:
parent
c00b38e9fb
commit
b2edcc7130
1 changed files with 10 additions and 18 deletions
|
@ -1219,18 +1219,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
debug!("match_candidates: {:?} candidates fully matched", fully_matched);
|
debug!("match_candidates: {:?} candidates fully matched", fully_matched);
|
||||||
let (matched_candidates, unmatched_candidates) = candidates.split_at_mut(fully_matched);
|
let (matched_candidates, unmatched_candidates) = candidates.split_at_mut(fully_matched);
|
||||||
|
|
||||||
let block = if !matched_candidates.is_empty() {
|
let block = self.select_matched_candidates(matched_candidates, start_block, fake_borrows);
|
||||||
let otherwise_block =
|
|
||||||
self.select_matched_candidates(matched_candidates, start_block, fake_borrows);
|
|
||||||
|
|
||||||
if let Some(last_otherwise_block) = otherwise_block {
|
|
||||||
last_otherwise_block
|
|
||||||
} else {
|
|
||||||
self.cfg.start_new_block()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
start_block
|
|
||||||
};
|
|
||||||
|
|
||||||
// If there are no candidates that still need testing, we're
|
// If there are no candidates that still need testing, we're
|
||||||
// done. Since all matches are exhaustive, execution should
|
// done. Since all matches are exhaustive, execution should
|
||||||
|
@ -1282,11 +1271,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
matched_candidates: &mut [&mut Candidate<'_, 'tcx>],
|
matched_candidates: &mut [&mut Candidate<'_, 'tcx>],
|
||||||
start_block: BasicBlock,
|
start_block: BasicBlock,
|
||||||
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
|
fake_borrows: &mut Option<FxIndexSet<Place<'tcx>>>,
|
||||||
) -> Option<BasicBlock> {
|
) -> BasicBlock {
|
||||||
debug_assert!(
|
if matched_candidates.is_empty() {
|
||||||
!matched_candidates.is_empty(),
|
return start_block;
|
||||||
"select_matched_candidates called with no candidates",
|
}
|
||||||
);
|
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
matched_candidates.iter().all(|c| c.subcandidates.is_empty()),
|
matched_candidates.iter().all(|c| c.subcandidates.is_empty()),
|
||||||
"subcandidates should be empty in select_matched_candidates",
|
"subcandidates should be empty in select_matched_candidates",
|
||||||
|
@ -1356,7 +1344,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
candidate.pre_binding_block = Some(self.cfg.start_new_block());
|
candidate.pre_binding_block = Some(self.cfg.start_new_block());
|
||||||
}
|
}
|
||||||
|
|
||||||
reachable_candidates.last_mut().unwrap().otherwise_block
|
reachable_candidates
|
||||||
|
.last_mut()
|
||||||
|
.unwrap()
|
||||||
|
.otherwise_block
|
||||||
|
.unwrap_or_else(|| self.cfg.start_new_block())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tests a candidate where there are only or-patterns left to test, or
|
/// Tests a candidate where there are only or-patterns left to test, or
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue