Skip to content

Commit

Permalink
don't send block back to be marked unreachable twice
Browse files Browse the repository at this point in the history
  • Loading branch information
djzin committed Nov 14, 2017
1 parent c503fe1 commit 5b1cc1d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/librustc_mir/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
let num_enum_variants = self.hir.num_variants(adt_def);
let used_variants = variants.count();
let mut otherwise_block = None;
let mut target_blocks = Vec::with_capacity(num_enum_variants + 1);
let mut target_blocks = Vec::with_capacity(num_enum_variants);
let mut targets = Vec::with_capacity(used_variants + 1);
let mut values = Vec::with_capacity(used_variants);
let tcx = self.hir.tcx();
Expand All @@ -205,9 +205,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
if let Some(otherwise_block) = otherwise_block {
targets.push(otherwise_block);
} else {
let unreachable_block = self.unreachable_block();
targets.push(unreachable_block);
target_blocks.push(unreachable_block);
targets.push(self.unreachable_block());
}
debug!("num_enum_variants: {}, tested variants: {:?}, variants: {:?}",
num_enum_variants, values, variants);
Expand Down

0 comments on commit 5b1cc1d

Please sign in to comment.