Skip to content

Commit 778e197

Browse files
committed
Mark early otherwise optimization unsound
1 parent 1705a7d commit 778e197

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

compiler/rustc_mir/src/transform/early_otherwise_branch.rs

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ pub struct EarlyOtherwiseBranch;
2626

2727
impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
2828
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
29+
// FIXME(#78496)
30+
if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
31+
return;
32+
}
33+
2934
if tcx.sess.mir_opt_level() < 3 {
3035
return;
3136
}

src/test/mir-opt/early_otherwise_branch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Z mir-opt-level=4
1+
// compile-flags: -Z mir-opt-level=4 -Z unsound-mir-opts
22
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
33
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
44
match (x, y) {

src/test/mir-opt/early_otherwise_branch_3_element_tuple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Z mir-opt-level=4
1+
// compile-flags: -Z mir-opt-level=4 -Z unsound-mir-opts
22

33
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
44
fn opt1(x: Option<u32>, y: Option<u32>, z: Option<u32>) -> u32 {

0 commit comments

Comments
 (0)