Skip to content

Commit dda2b5e

Browse files
committed
Auto merge of #78039 - tmiasko:unreachable-block, r=Mark-Simulacrum
Remove unused cached_unreachable_block from MIR builder
2 parents 6f0ea29 + a65a283 commit dda2b5e

File tree

1 file changed

+0
-14
lines changed
  • compiler/rustc_mir_build/src/build

1 file changed

+0
-14
lines changed

compiler/rustc_mir_build/src/build/mod.rs

-14
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,6 @@ struct Builder<'a, 'tcx> {
351351
unit_temp: Option<Place<'tcx>>,
352352

353353
var_debug_info: Vec<VarDebugInfo<'tcx>>,
354-
355-
/// Cached block with the `UNREACHABLE` terminator.
356-
cached_unreachable_block: Option<BasicBlock>,
357354
}
358355

359356
impl<'a, 'tcx> Builder<'a, 'tcx> {
@@ -634,10 +631,6 @@ where
634631
builder.cfg.terminate(return_block, source_info, TerminatorKind::Return);
635632
let should_abort = should_abort_on_panic(tcx, fn_def_id, abi);
636633
builder.build_drop_trees(should_abort);
637-
// Attribute any unreachable codepaths to the function's closing brace
638-
if let Some(unreachable_block) = builder.cached_unreachable_block {
639-
builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable);
640-
}
641634
return_block.unit()
642635
}));
643636

@@ -676,12 +669,6 @@ fn construct_const<'a, 'tcx>(
676669

677670
builder.build_drop_trees(false);
678671

679-
// Constants may be match expressions in which case an unreachable block may
680-
// be created, so terminate it properly.
681-
if let Some(unreachable_block) = builder.cached_unreachable_block {
682-
builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable);
683-
}
684-
685672
builder.finish()
686673
}
687674

@@ -757,7 +744,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
757744
var_indices: Default::default(),
758745
unit_temp: None,
759746
var_debug_info: vec![],
760-
cached_unreachable_block: None,
761747
};
762748

763749
assert_eq!(builder.cfg.start_new_block(), START_BLOCK);

0 commit comments

Comments
 (0)