Skip to content

Commit 5b1cc1d

Browse files
committed
don't send block back to be marked unreachable twice
1 parent c503fe1 commit 5b1cc1d

File tree

1 file changed

+2
-4
lines changed
  • src/librustc_mir/build/matches

1 file changed

+2
-4
lines changed

src/librustc_mir/build/matches/test.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
187187
let num_enum_variants = self.hir.num_variants(adt_def);
188188
let used_variants = variants.count();
189189
let mut otherwise_block = None;
190-
let mut target_blocks = Vec::with_capacity(num_enum_variants + 1);
190+
let mut target_blocks = Vec::with_capacity(num_enum_variants);
191191
let mut targets = Vec::with_capacity(used_variants + 1);
192192
let mut values = Vec::with_capacity(used_variants);
193193
let tcx = self.hir.tcx();
@@ -205,9 +205,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
205205
if let Some(otherwise_block) = otherwise_block {
206206
targets.push(otherwise_block);
207207
} else {
208-
let unreachable_block = self.unreachable_block();
209-
targets.push(unreachable_block);
210-
target_blocks.push(unreachable_block);
208+
targets.push(self.unreachable_block());
211209
}
212210
debug!("num_enum_variants: {}, tested variants: {:?}, variants: {:?}",
213211
num_enum_variants, values, variants);

0 commit comments

Comments
 (0)