]> git.lizzy.rs Git - rust.git/commitdiff
Mark early otherwise optimization unsound
authorSantiago Pastorino <spastorino@gmail.com>
Thu, 18 Mar 2021 20:35:46 +0000 (17:35 -0300)
committerSantiago Pastorino <spastorino@gmail.com>
Thu, 18 Mar 2021 23:57:44 +0000 (20:57 -0300)
compiler/rustc_mir/src/transform/early_otherwise_branch.rs
src/test/mir-opt/early_otherwise_branch.rs
src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs

index e64a539c7f8e45b2b6d24a1d538a7017699ffae5..f7ea9faec47283cf2903062fedd031d0f9c4a440 100644 (file)
 
 impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
     fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
+        //  FIXME(#78496)
+        if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
+            return;
+        }
+
         if tcx.sess.mir_opt_level() < 3 {
             return;
         }
index 548213ab83caf5e48e6992001bc9065c9d86f779..b2caf7d7b8fde4353c63dd1829f6ecc08cbb2ba6 100644 (file)
@@ -1,4 +1,4 @@
-// compile-flags: -Z mir-opt-level=4
+// compile-flags: -Z mir-opt-level=4 -Z unsound-mir-opts
 // EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
 fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
     match (x, y) {
index aa304f747f748e312adc3e51e15bd7c86146553a..8527c01d756589ec0446deaee306eee29886eb3c 100644 (file)
@@ -1,4 +1,4 @@
-// compile-flags: -Z mir-opt-level=4
+// compile-flags: -Z mir-opt-level=4 -Z unsound-mir-opts
 
 // EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
 fn opt1(x: Option<u32>, y: Option<u32>, z: Option<u32>) -> u32 {