about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2024-01-15 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2024-01-23 20:58:44 +0100
commitc8e4aaa023334ea9844eb76eebe41da138895a81 (patch)
tree1f244983de3b76d61c1b1f9ae5b3ea35d8cade03
parent6265a95b3735a51cca1d48b8bbc3c8a6a035e15b (diff)
downloadrust-c8e4aaa023334ea9844eb76eebe41da138895a81.tar.gz
rust-c8e4aaa023334ea9844eb76eebe41da138895a81.zip
Move condition enabling the pass to `is_enabled`
The practical motivation is to omit the pass from -Zdump-mir=all when
disabled.
-rw-r--r--compiler/rustc_mir_transform/src/remove_storage_markers.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/compiler/rustc_mir_transform/src/remove_storage_markers.rs b/compiler/rustc_mir_transform/src/remove_storage_markers.rs
index 795f5232ee3..f68e592db15 100644
--- a/compiler/rustc_mir_transform/src/remove_storage_markers.rs
+++ b/compiler/rustc_mir_transform/src/remove_storage_markers.rs
@@ -7,14 +7,10 @@ pub struct RemoveStorageMarkers;
 
 impl<'tcx> MirPass<'tcx> for RemoveStorageMarkers {
     fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
-        sess.mir_opt_level() > 0
+        sess.mir_opt_level() > 0 && !sess.emit_lifetime_markers()
     }
 
-    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
-        if tcx.sess.emit_lifetime_markers() {
-            return;
-        }
-
+    fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
         trace!("Running RemoveStorageMarkers on {:?}", body.source);
         for data in body.basic_blocks.as_mut_preserves_cfg() {
             data.statements.retain(|statement| match statement.kind {