about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/const_debuginfo.rs
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2021-12-02 09:17:32 -0800
committerDylan MacKenzie <ecstaticmorse@gmail.com>2021-12-02 17:31:38 -0800
commitfd18b45e112d07c20d12303aa5d7d7ffd28830b7 (patch)
tree539aa8d26fb7341c8f5f989b44bf831570da82c3 /compiler/rustc_mir_transform/src/const_debuginfo.rs
parentc1a501b131ae99cb139b0843125f27d548b4cd1b (diff)
downloadrust-fd18b45e112d07c20d12303aa5d7d7ffd28830b7.tar.gz
rust-fd18b45e112d07c20d12303aa5d7d7ffd28830b7.zip
Update passes with new interface
Diffstat (limited to 'compiler/rustc_mir_transform/src/const_debuginfo.rs')
-rw-r--r--compiler/rustc_mir_transform/src/const_debuginfo.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/const_debuginfo.rs b/compiler/rustc_mir_transform/src/const_debuginfo.rs
index b613634560f..3613fa4560d 100644
--- a/compiler/rustc_mir_transform/src/const_debuginfo.rs
+++ b/compiler/rustc_mir_transform/src/const_debuginfo.rs
@@ -15,11 +15,11 @@ use rustc_index::{bit_set::BitSet, vec::IndexVec};
 pub struct ConstDebugInfo;
 
 impl<'tcx> MirPass<'tcx> for ConstDebugInfo {
-    fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
-        if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
-            return;
-        }
+    fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
+        sess.opts.debugging_opts.unsound_mir_opts && sess.mir_opt_level() > 0
+    }
 
+    fn run_pass(&self, _: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
         trace!("running ConstDebugInfo on {:?}", body.source);
 
         for (local, constant) in find_optimization_oportunities(body) {