about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2020-10-17 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2020-10-17 00:00:00 +0000
commita65a28333257dcb2abe0a2db2edd151865360191 (patch)
tree0bb91e61ec9ebe7f6a29c120a88817e939bf101e
parent3f50dea4d0dfce527871bb0a198dc17c479e697b (diff)
downloadrust-a65a28333257dcb2abe0a2db2edd151865360191.tar.gz
rust-a65a28333257dcb2abe0a2db2edd151865360191.zip
Remove unused cached_unreachable_block from MIR builder
-rw-r--r--compiler/rustc_mir_build/src/build/mod.rs14
1 files changed, 0 insertions, 14 deletions
diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs
index 220e3b11a6a..899fc647493 100644
--- a/compiler/rustc_mir_build/src/build/mod.rs
+++ b/compiler/rustc_mir_build/src/build/mod.rs
@@ -351,9 +351,6 @@ struct Builder<'a, 'tcx> {
     unit_temp: Option<Place<'tcx>>,
 
     var_debug_info: Vec<VarDebugInfo<'tcx>>,
-
-    /// Cached block with the `UNREACHABLE` terminator.
-    cached_unreachable_block: Option<BasicBlock>,
 }
 
 impl<'a, 'tcx> Builder<'a, 'tcx> {
@@ -634,10 +631,6 @@ where
         builder.cfg.terminate(return_block, source_info, TerminatorKind::Return);
         let should_abort = should_abort_on_panic(tcx, fn_def_id, abi);
         builder.build_drop_trees(should_abort);
-        // Attribute any unreachable codepaths to the function's closing brace
-        if let Some(unreachable_block) = builder.cached_unreachable_block {
-            builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable);
-        }
         return_block.unit()
     }));
 
@@ -676,12 +669,6 @@ fn construct_const<'a, 'tcx>(
 
     builder.build_drop_trees(false);
 
-    // Constants may be match expressions in which case an unreachable block may
-    // be created, so terminate it properly.
-    if let Some(unreachable_block) = builder.cached_unreachable_block {
-        builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable);
-    }
-
     builder.finish()
 }
 
@@ -757,7 +744,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
             var_indices: Default::default(),
             unit_temp: None,
             var_debug_info: vec![],
-            cached_unreachable_block: None,
         };
 
         assert_eq!(builder.cfg.start_new_block(), START_BLOCK);