diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 15988c0ea6b37..a684f9bdff19a 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -110,7 +110,7 @@ pub mod simplify; mod simplify_branches; mod simplify_comparison_integral; mod sroa; -mod uninhabited_enum_branching; +mod unreachable_enum_branching; mod unreachable_prop; use rustc_const_eval::transform::check_consts::{self, ConstCx}; @@ -580,9 +580,10 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &remove_zsts::RemoveZsts, &remove_unneeded_drops::RemoveUnneededDrops, // Type instantiation may create uninhabited enums. - &uninhabited_enum_branching::UninhabitedEnumBranching, + // Also eliminates some unreachable branches based on variants of enums. + &unreachable_enum_branching::UnreachableEnumBranching, &unreachable_prop::UnreachablePropagation, - &o1(simplify::SimplifyCfg::AfterUninhabitedEnumBranching), + &o1(simplify::SimplifyCfg::AfterUnreachableEnumBranching), // Inlining may have introduced a lot of redundant code and a large move pattern. // Now, we need to shrink the generated MIR. diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index 574330cc355c4..14772080ce5f0 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -44,7 +44,7 @@ pub enum SimplifyCfg { PreOptimizations, Final, MakeShim, - AfterUninhabitedEnumBranching, + AfterUnreachableEnumBranching, } impl SimplifyCfg { @@ -57,8 +57,8 @@ impl SimplifyCfg { SimplifyCfg::PreOptimizations => "SimplifyCfg-pre-optimizations", SimplifyCfg::Final => "SimplifyCfg-final", SimplifyCfg::MakeShim => "SimplifyCfg-make_shim", - SimplifyCfg::AfterUninhabitedEnumBranching => { - "SimplifyCfg-after-uninhabited-enum-branching" + SimplifyCfg::AfterUnreachableEnumBranching => { + "SimplifyCfg-after-unreachable-enum-branching" } } } diff --git a/compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs similarity index 69% rename from compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs rename to compiler/rustc_mir_transform/src/unreachable_enum_branching.rs index 57fe46ad75aee..66b6235eb9380 100644 --- a/compiler/rustc_mir_transform/src/uninhabited_enum_branching.rs +++ b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs @@ -1,4 +1,4 @@ -//! A pass that eliminates branches on uninhabited enum variants. +//! A pass that eliminates branches on uninhabited or unreachable enum variants. use crate::MirPass; use rustc_data_structures::fx::FxHashSet; @@ -11,7 +11,7 @@ use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{Ty, TyCtxt}; use rustc_target::abi::{Abi, Variants}; -pub struct UninhabitedEnumBranching; +pub struct UnreachableEnumBranching; fn get_discriminant_local(terminator: &TerminatorKind<'_>) -> Option { if let TerminatorKind::SwitchInt { discr: Operand::Move(p), .. } = terminator { @@ -71,13 +71,13 @@ fn variant_discriminants<'tcx>( } } -impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching { +impl<'tcx> MirPass<'tcx> for UnreachableEnumBranching { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { sess.mir_opt_level() > 0 } fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - trace!("UninhabitedEnumBranching starting for {:?}", body.source); + trace!("UnreachableEnumBranching starting for {:?}", body.source); let mut unreachable_targets = Vec::new(); let mut patch = MirPatch::new(body); @@ -96,8 +96,10 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching { ); let mut allowed_variants = if let Ok(layout) = layout { + // Find allowed variants based on uninhabited. variant_discriminants(&layout, discriminant_ty, tcx) } else if let Some(variant_range) = discriminant_ty.variant_range(tcx) { + // If there are some generics, we can still get the allowed variants. variant_range .map(|variant| { discriminant_ty.discriminant_for_variant(tcx, variant).unwrap().val @@ -121,9 +123,26 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching { } let otherwise_is_empty_unreachable = body.basic_blocks[targets.otherwise()].is_empty_unreachable(); - // After resolving https://github.com/llvm/llvm-project/issues/78578, - // we can remove the limit on the number of successors. fn check_successors(basic_blocks: &BasicBlocks<'_>, bb: BasicBlock) -> bool { + // After resolving https://github.com/llvm/llvm-project/issues/78578, + // We can remove this check. + // The main issue here is that `early-tailduplication` causes compile time overhead + // and potential performance problems. + // Simply put, when encounter a switch (indirect branch) statement, + // `early-tailduplication` tries to duplicate the switch branch statement with BB + // into (each) predecessors. This makes CFG very complex. + // We can understand it as it transforms the following code + // ```rust + // match a { ... many cases }; + // match b { ... many cases }; + // ``` + // into + // ```rust + // match a { ... many match b { goto BB cases } } + // ... BB cases + // ``` + // Abandon this transformation when it is possible (the best effort) + // to encounter the problem. let mut successors = basic_blocks[bb].terminator().successors(); let Some(first_successor) = successors.next() else { return true }; if successors.next().is_some() { @@ -136,11 +155,32 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching { }; true } + // If and only if there is a variant that does not have a branch set, + // change the current of otherwise as the variant branch and set otherwise to unreachable. + // It transforms following code + // ```rust + // match c { + // Ordering::Less => 1, + // Ordering::Equal => 2, + // _ => 3, + // } + // ``` + // to + // ```rust + // match c { + // Ordering::Less => 1, + // Ordering::Equal => 2, + // Ordering::Greater => 3, + // } + // ``` let otherwise_is_last_variant = !otherwise_is_empty_unreachable && allowed_variants.len() == 1 - && check_successors(&body.basic_blocks, targets.otherwise()); + // Despite the LLVM issue, we hope that small enum can still be transformed. + // This is valuable for both `a <= b` and `if let Some/Ok(v)`. + && (targets.all_targets().len() <= 3 + || check_successors(&body.basic_blocks, targets.otherwise())); let replace_otherwise_to_unreachable = otherwise_is_last_variant - || !otherwise_is_empty_unreachable && allowed_variants.is_empty(); + || (!otherwise_is_empty_unreachable && allowed_variants.is_empty()); if unreachable_targets.is_empty() && !replace_otherwise_to_unreachable { continue; @@ -150,6 +190,7 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching { let mut targets = targets.clone(); if replace_otherwise_to_unreachable { if otherwise_is_last_variant { + // We have checked that `allowed_variants` has only one element. #[allow(rustc::potential_query_instability)] let last_variant = *allowed_variants.iter().next().unwrap(); targets.add_target(last_variant, targets.otherwise()); diff --git a/tests/codegen/enum/uninhabited_enum_default_branch.rs b/tests/codegen/enum/uninhabited_enum_default_branch.rs deleted file mode 100644 index 5f318f18dec68..0000000000000 --- a/tests/codegen/enum/uninhabited_enum_default_branch.rs +++ /dev/null @@ -1,24 +0,0 @@ -//@ compile-flags: -O - -#![crate_type = "lib"] - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -pub struct Int(u32); - -const A: Int = Int(201); -const B: Int = Int(270); -const C: Int = Int(153); - -// CHECK-LABEL: @foo( -// CHECK-SAME: [[TMP0:%.*]]) -// CHECK-NEXT: start: -// CHECK-NEXT: [[TMP1:%.*]] = add i32 [[TMP0]], -201 -// CHECK-NEXT: icmp ult i32 [[TMP1]], 70 -// CHECK-NEXT: icmp eq i32 [[TMP0]], 153 -// CHECK-NEXT: [[SPEC_SELECT:%.*]] = or i1 -// CHECK-NEXT: ret i1 [[SPEC_SELECT]] -#[no_mangle] -pub fn foo(x: Int) -> bool { - (x >= A && x <= B) - || x == C -} diff --git a/tests/codegen/enum/unreachable_enum_default_branch.rs b/tests/codegen/enum/unreachable_enum_default_branch.rs new file mode 100644 index 0000000000000..dae01cfb055e2 --- /dev/null +++ b/tests/codegen/enum/unreachable_enum_default_branch.rs @@ -0,0 +1,43 @@ +//@ compile-flags: -O + +#![crate_type = "lib"] + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct Int(u32); + +const A: Int = Int(201); +const B: Int = Int(270); +const C: Int = Int(153); + +// The code is from https://github.com/rust-lang/rust/issues/119520. +// This code will basically turn into `matches!(x.partial_cmp(&A), Some(Greater | Equal))`. +// The otherwise branch must be `Less`. +// CHECK-LABEL: @implicit_match( +// CHECK-SAME: [[TMP0:%.*]]) +// CHECK-NEXT: start: +// CHECK-NEXT: [[TMP1:%.*]] = add i32 [[TMP0]], -201 +// CHECK-NEXT: icmp ult i32 [[TMP1]], 70 +// CHECK-NEXT: icmp eq i32 [[TMP0]], 153 +// CHECK-NEXT: [[SPEC_SELECT:%.*]] = or i1 +// CHECK-NEXT: ret i1 [[SPEC_SELECT]] +#[no_mangle] +pub fn implicit_match(x: Int) -> bool { + (x >= A && x <= B) + || x == C +} + +// The code is from https://github.com/rust-lang/rust/issues/110097. +// We expect it to generate the same optimized code as a full match. +// CHECK-LABEL: @if_let( +// CHECK-NEXT: start: +// CHECK-NEXT: insertvalue +// CHECK-NEXT: insertvalue +// CHECK-NEXT: ret +#[no_mangle] +pub fn if_let(val: Result) -> Result { + if let Ok(x) = val { + Ok(x) + } else { + Err(()) + } +} diff --git a/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff b/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff new file mode 100644 index 0000000000000..4400cfaef810c --- /dev/null +++ b/tests/mir-opt/simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff @@ -0,0 +1,33 @@ +- // MIR for `assert_nonzero_nonmax` before SimplifyCfg-after-unreachable-enum-branching ++ // MIR for `assert_nonzero_nonmax` after SimplifyCfg-after-unreachable-enum-branching + + fn assert_nonzero_nonmax(_1: u8) -> u8 { + let mut _0: u8; + + bb0: { +- switchInt(_1) -> [0: bb3, 1: bb2, 255: bb3, otherwise: bb4]; ++ switchInt(_1) -> [0: bb2, 1: bb1, 255: bb2, otherwise: bb3]; + } + + bb1: { +- _0 = const 1_u8; +- return; +- } +- +- bb2: { + _0 = const 2_u8; + return; + } + +- bb3: { ++ bb2: { + unreachable; + } + +- bb4: { ++ bb3: { + _0 = _1; + return; + } + } + diff --git a/tests/mir-opt/simplify_dead_blocks.rs b/tests/mir-opt/simplify_dead_blocks.rs new file mode 100644 index 0000000000000..d4de85622d41e --- /dev/null +++ b/tests/mir-opt/simplify_dead_blocks.rs @@ -0,0 +1,52 @@ +//@ unit-test: SimplifyCfg-after-unreachable-enum-branching +#![feature(custom_mir, core_intrinsics)] +#![crate_type = "lib"] + +use std::intrinsics::mir::*; + +// Check that we correctly cleaned up the dead BB. +// EMIT_MIR simplify_dead_blocks.assert_nonzero_nonmax.SimplifyCfg-after-unreachable-enum-branching.diff +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { + // CHECK-LABEL: fn assert_nonzero_nonmax( + // CHECK: bb0: { + // CHECK-NEXT: switchInt({{.*}}) -> [0: [[unreachable:bb.*]], 1: [[retblock2:bb.*]], 255: [[unreachable:bb.*]], otherwise: [[retblock:bb.*]]]; + // CHECK-NEXT: } + // CHECK-NOT: _0 = const 1_u8; + // CHECK: [[retblock2]]: { + // CHECK-NEXT: _0 = const 2_u8; + // CHECK-NEXT: return; + // CHECK-NEXT: } + // CHECK: [[unreachable]]: { + // CHECK-NEXT: unreachable; + // CHECK-NEXT: } + // CHECK: [[retblock]]: { + // CHECK-NEXT: _0 = _1; + // CHECK-NEXT: return; + // CHECK-NEXT: } + mir!( + { + match x { + 0 => unreachable, + 1 => retblock2, + u8::MAX => unreachable, + _ => retblock, + } + } + deadRetblock1 = { + RET = 1; + Return() + } + retblock2 = { + RET = 2; + Return() + } + unreachable = { + Unreachable() + } + retblock = { + RET = x; + Return() + } + ) +} diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff b/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff deleted file mode 100644 index 35c0a4d45dfb5..0000000000000 --- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff +++ /dev/null @@ -1,25 +0,0 @@ -- // MIR for `assert_nonzero_nonmax` before SimplifyCfg-after-uninhabited-enum-branching -+ // MIR for `assert_nonzero_nonmax` after SimplifyCfg-after-uninhabited-enum-branching - - fn assert_nonzero_nonmax(_1: u8) -> u8 { - let mut _0: u8; - - bb0: { -- switchInt(_1) -> [0: bb1, 255: bb2, otherwise: bb3]; -+ switchInt(_1) -> [0: bb1, 255: bb1, otherwise: bb2]; - } - - bb1: { - unreachable; - } - - bb2: { -- unreachable; -- } -- -- bb3: { - _0 = _1; - return; - } - } - diff --git a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs b/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs deleted file mode 100644 index d94e611185563..0000000000000 --- a/tests/mir-opt/simplify_duplicate_unreachable_blocks.rs +++ /dev/null @@ -1,31 +0,0 @@ -// skip-filecheck -#![feature(custom_mir, core_intrinsics)] -#![crate_type = "lib"] - -use std::intrinsics::mir::*; - -//@ unit-test: SimplifyCfg-after-uninhabited-enum-branching - -// EMIT_MIR simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff -#[custom_mir(dialect = "runtime", phase = "post-cleanup")] -pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { - mir!( - { - match x { - 0 => unreachable1, - u8::MAX => unreachable2, - _ => retblock, - } - } - unreachable1 = { - Unreachable() - } - unreachable2 = { - Unreachable() - } - retblock = { - RET = x; - Return() - } - ) -} diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UnreachableEnumBranching.diff similarity index 83% rename from tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff rename to tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UnreachableEnumBranching.diff index daff4f9c85b03..098b620dfaab7 100644 --- a/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_fallthrough_elimination.eliminate_fallthrough.UnreachableEnumBranching.diff @@ -1,5 +1,5 @@ -- // MIR for `eliminate_fallthrough` before UninhabitedEnumBranching -+ // MIR for `eliminate_fallthrough` after UninhabitedEnumBranching +- // MIR for `eliminate_fallthrough` before UnreachableEnumBranching ++ // MIR for `eliminate_fallthrough` after UnreachableEnumBranching fn eliminate_fallthrough(_1: S) -> u32 { debug s => _1; diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UnreachableEnumBranching.diff similarity index 83% rename from tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff rename to tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UnreachableEnumBranching.diff index 28a8c251d956a..995e32b033f24 100644 --- a/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff +++ b/tests/mir-opt/uninhabited_fallthrough_elimination.keep_fallthrough.UnreachableEnumBranching.diff @@ -1,5 +1,5 @@ -- // MIR for `keep_fallthrough` before UninhabitedEnumBranching -+ // MIR for `keep_fallthrough` after UninhabitedEnumBranching +- // MIR for `keep_fallthrough` before UnreachableEnumBranching ++ // MIR for `keep_fallthrough` after UnreachableEnumBranching fn keep_fallthrough(_1: S) -> u32 { debug s => _1; diff --git a/tests/mir-opt/uninhabited_fallthrough_elimination.rs b/tests/mir-opt/uninhabited_fallthrough_elimination.rs index 7dd41aea5ed11..537935d8ae433 100644 --- a/tests/mir-opt/uninhabited_fallthrough_elimination.rs +++ b/tests/mir-opt/uninhabited_fallthrough_elimination.rs @@ -9,7 +9,7 @@ enum S { use S::*; -// EMIT_MIR uninhabited_fallthrough_elimination.keep_fallthrough.UninhabitedEnumBranching.diff +// EMIT_MIR uninhabited_fallthrough_elimination.keep_fallthrough.UnreachableEnumBranching.diff fn keep_fallthrough(s: S) -> u32 { match s { A(_) => 1, @@ -18,7 +18,7 @@ fn keep_fallthrough(s: S) -> u32 { } } -// EMIT_MIR uninhabited_fallthrough_elimination.eliminate_fallthrough.UninhabitedEnumBranching.diff +// EMIT_MIR uninhabited_fallthrough_elimination.eliminate_fallthrough.UnreachableEnumBranching.diff fn eliminate_fallthrough(s: S) -> u32 { match s { C => 1, diff --git a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff similarity index 95% rename from tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff index 1b7517c8d0107..e5dab5d52a6b7 100644 --- a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `byref` before UninhabitedEnumBranching -+ // MIR for `byref` after UninhabitedEnumBranching +- // MIR for `byref` before UnreachableEnumBranching ++ // MIR for `byref` after UnreachableEnumBranching fn byref() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff similarity index 95% rename from tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff index 1b7517c8d0107..e5dab5d52a6b7 100644 --- a/tests/mir-opt/uninhabited_enum_branching.byref.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.byref.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `byref` before UninhabitedEnumBranching -+ // MIR for `byref` after UninhabitedEnumBranching +- // MIR for `byref` before UnreachableEnumBranching ++ // MIR for `byref` after UnreachableEnumBranching fn byref() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff similarity index 85% rename from tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff index f9a43480917e6..ea6cdbfbe6612 100644 --- a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `custom_discriminant` before UninhabitedEnumBranching -+ // MIR for `custom_discriminant` after UninhabitedEnumBranching +- // MIR for `custom_discriminant` before UnreachableEnumBranching ++ // MIR for `custom_discriminant` after UnreachableEnumBranching fn custom_discriminant() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff similarity index 85% rename from tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff index f9a43480917e6..ea6cdbfbe6612 100644 --- a/tests/mir-opt/uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `custom_discriminant` before UninhabitedEnumBranching -+ // MIR for `custom_discriminant` after UninhabitedEnumBranching +- // MIR for `custom_discriminant` before UnreachableEnumBranching ++ // MIR for `custom_discriminant` after UnreachableEnumBranching fn custom_discriminant() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff similarity index 89% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff index 383fde4d787b9..02b9f02f4c0ec 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t1` before UninhabitedEnumBranching -+ // MIR for `otherwise_t1` after UninhabitedEnumBranching +- // MIR for `otherwise_t1` before UnreachableEnumBranching ++ // MIR for `otherwise_t1` after UnreachableEnumBranching fn otherwise_t1() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff similarity index 89% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff index 383fde4d787b9..02b9f02f4c0ec 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t1` before UninhabitedEnumBranching -+ // MIR for `otherwise_t1` after UninhabitedEnumBranching +- // MIR for `otherwise_t1` before UnreachableEnumBranching ++ // MIR for `otherwise_t1` after UnreachableEnumBranching fn otherwise_t1() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff similarity index 87% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff index 3a2dc19db71cd..a6d6e0861b1ba 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t2` before UninhabitedEnumBranching -+ // MIR for `otherwise_t2` after UninhabitedEnumBranching +- // MIR for `otherwise_t2` before UnreachableEnumBranching ++ // MIR for `otherwise_t2` after UnreachableEnumBranching fn otherwise_t2() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff similarity index 87% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff index 3a2dc19db71cd..a6d6e0861b1ba 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t2` before UninhabitedEnumBranching -+ // MIR for `otherwise_t2` after UninhabitedEnumBranching +- // MIR for `otherwise_t2` before UnreachableEnumBranching ++ // MIR for `otherwise_t2` after UnreachableEnumBranching fn otherwise_t2() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff similarity index 89% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff index 5dc1e2b73f6a4..d3376442376d3 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t3` before UninhabitedEnumBranching -+ // MIR for `otherwise_t3` after UninhabitedEnumBranching +- // MIR for `otherwise_t3` before UnreachableEnumBranching ++ // MIR for `otherwise_t3` after UnreachableEnumBranching fn otherwise_t3() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff similarity index 89% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff index 5dc1e2b73f6a4..d3376442376d3 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t3` before UninhabitedEnumBranching -+ // MIR for `otherwise_t3` after UninhabitedEnumBranching +- // MIR for `otherwise_t3` before UnreachableEnumBranching ++ // MIR for `otherwise_t3` after UnreachableEnumBranching fn otherwise_t3() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff similarity index 88% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff index 1352dda49715b..8f0d5b7cd99c4 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t4` before UninhabitedEnumBranching -+ // MIR for `otherwise_t4` after UninhabitedEnumBranching +- // MIR for `otherwise_t4` before UnreachableEnumBranching ++ // MIR for `otherwise_t4` after UnreachableEnumBranching fn otherwise_t4() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff similarity index 88% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff index 1352dda49715b..8f0d5b7cd99c4 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `otherwise_t4` before UninhabitedEnumBranching -+ // MIR for `otherwise_t4` after UninhabitedEnumBranching +- // MIR for `otherwise_t4` before UnreachableEnumBranching ++ // MIR for `otherwise_t4` after UnreachableEnumBranching fn otherwise_t4() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff similarity index 84% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff index 40dd961fbac4d..b1ecd00858290 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -1,7 +1,7 @@ -- // MIR for `otherwise_t4_uninhabited_default` before UninhabitedEnumBranching -+ // MIR for `otherwise_t4_uninhabited_default` after UninhabitedEnumBranching +- // MIR for `otherwise_t4_unreachable_default` before UnreachableEnumBranching ++ // MIR for `otherwise_t4_unreachable_default` after UnreachableEnumBranching - fn otherwise_t4_uninhabited_default() -> () { + fn otherwise_t4_unreachable_default() -> () { let mut _0: (); let _1: &str; let mut _2: Test4; diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff similarity index 84% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index 40dd961fbac4d..b1ecd00858290 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -1,7 +1,7 @@ -- // MIR for `otherwise_t4_uninhabited_default` before UninhabitedEnumBranching -+ // MIR for `otherwise_t4_uninhabited_default` after UninhabitedEnumBranching +- // MIR for `otherwise_t4_unreachable_default` before UnreachableEnumBranching ++ // MIR for `otherwise_t4_unreachable_default` after UnreachableEnumBranching - fn otherwise_t4_uninhabited_default() -> () { + fn otherwise_t4_unreachable_default() -> () { let mut _0: (); let _1: &str; let mut _2: Test4; diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff similarity index 87% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff index ac39f6be6c634..28c6d4fb67599 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-abort.diff @@ -1,7 +1,7 @@ -- // MIR for `otherwise_t4_uninhabited_default_2` before UninhabitedEnumBranching -+ // MIR for `otherwise_t4_uninhabited_default_2` after UninhabitedEnumBranching +- // MIR for `otherwise_t4_unreachable_default_2` before UnreachableEnumBranching ++ // MIR for `otherwise_t4_unreachable_default_2` after UnreachableEnumBranching - fn otherwise_t4_uninhabited_default_2() -> () { + fn otherwise_t4_unreachable_default_2() -> () { let mut _0: (); let _1: &str; let mut _2: Test4; diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff similarity index 87% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff index ac39f6be6c634..28c6d4fb67599 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.panic-unwind.diff @@ -1,7 +1,7 @@ -- // MIR for `otherwise_t4_uninhabited_default_2` before UninhabitedEnumBranching -+ // MIR for `otherwise_t4_uninhabited_default_2` after UninhabitedEnumBranching +- // MIR for `otherwise_t4_unreachable_default_2` before UnreachableEnumBranching ++ // MIR for `otherwise_t4_unreachable_default_2` after UnreachableEnumBranching - fn otherwise_t4_uninhabited_default_2() -> () { + fn otherwise_t4_unreachable_default_2() -> () { let mut _0: (); let _1: &str; let mut _2: Test4; diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff similarity index 85% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff index 8180428a6f459..f36a7efd80d45 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-abort.diff @@ -1,7 +1,7 @@ -- // MIR for `otherwise_t5_uninhabited_default` before UninhabitedEnumBranching -+ // MIR for `otherwise_t5_uninhabited_default` after UninhabitedEnumBranching +- // MIR for `otherwise_t5_unreachable_default` before UnreachableEnumBranching ++ // MIR for `otherwise_t5_unreachable_default` after UnreachableEnumBranching - fn otherwise_t5_uninhabited_default() -> () { + fn otherwise_t5_unreachable_default() -> () { let mut _0: (); let _1: &str; let mut _2: Test5; diff --git a/tests/mir-opt/uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff similarity index 86% rename from tests/mir-opt/uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff index b13d5816aed9d..20e31c24c84b5 100644 --- a/tests/mir-opt/uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.panic-unwind.diff @@ -1,7 +1,7 @@ -- // MIR for `otherwise_t5_uninhabited_default` before UninhabitedEnumBranching -+ // MIR for `otherwise_t5_uninhabited_default` after UninhabitedEnumBranching +- // MIR for `otherwise_t5_unreachable_default` before UnreachableEnumBranching ++ // MIR for `otherwise_t5_unreachable_default` after UnreachableEnumBranching - fn otherwise_t5_uninhabited_default() -> () { + fn otherwise_t5_unreachable_default() -> () { let mut _0: (); let _1: &str; let mut _2: Test5; diff --git a/tests/mir-opt/uninhabited_enum_branching.rs b/tests/mir-opt/unreachable_enum_branching.rs similarity index 80% rename from tests/mir-opt/uninhabited_enum_branching.rs rename to tests/mir-opt/unreachable_enum_branching.rs index 6de001be9791e..156b23657b7a6 100644 --- a/tests/mir-opt/uninhabited_enum_branching.rs +++ b/tests/mir-opt/unreachable_enum_branching.rs @@ -1,4 +1,4 @@ -//@ unit-test: UninhabitedEnumBranching +//@ unit-test: UnreachableEnumBranching // EMIT_MIR_FOR_EACH_PANIC_STRATEGY enum Empty {} @@ -45,7 +45,7 @@ struct Plop { test3: Test3, } -// EMIT_MIR uninhabited_enum_branching.simple.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.simple.UnreachableEnumBranching.diff fn simple() { // CHECK-LABEL: fn simple( // CHECK: [[discr:_.*]] = discriminant( @@ -59,7 +59,7 @@ fn simple() { }; } -// EMIT_MIR uninhabited_enum_branching.custom_discriminant.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.custom_discriminant.UnreachableEnumBranching.diff fn custom_discriminant() { // CHECK-LABEL: fn custom_discriminant( // CHECK: [[discr:_.*]] = discriminant( @@ -72,7 +72,7 @@ fn custom_discriminant() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t1.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.otherwise_t1.UnreachableEnumBranching.diff fn otherwise_t1() { // CHECK-LABEL: fn otherwise_t1( // CHECK: [[discr:_.*]] = discriminant( @@ -86,7 +86,7 @@ fn otherwise_t1() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t2.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.otherwise_t2.UnreachableEnumBranching.diff fn otherwise_t2() { // CHECK-LABEL: fn otherwise_t2( // CHECK: [[discr:_.*]] = discriminant( @@ -99,7 +99,7 @@ fn otherwise_t2() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t3.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.otherwise_t3.UnreachableEnumBranching.diff fn otherwise_t3() { // CHECK-LABEL: fn otherwise_t3( // CHECK: [[discr:_.*]] = discriminant( @@ -116,9 +116,9 @@ fn otherwise_t3() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t4_uninhabited_default.UninhabitedEnumBranching.diff -fn otherwise_t4_uninhabited_default() { - // CHECK-LABEL: fn otherwise_t4_uninhabited_default( +// EMIT_MIR unreachable_enum_branching.otherwise_t4_unreachable_default.UnreachableEnumBranching.diff +fn otherwise_t4_unreachable_default() { + // CHECK-LABEL: fn otherwise_t4_unreachable_default( // CHECK: [[discr:_.*]] = discriminant( // CHECK: switchInt(move [[discr]]) -> [0: bb2, 1: bb3, 2: bb4, 3: bb1, otherwise: [[unreachable:bb.*]]]; // CHECK: [[unreachable]]: { @@ -131,9 +131,9 @@ fn otherwise_t4_uninhabited_default() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t4_uninhabited_default_2.UninhabitedEnumBranching.diff -fn otherwise_t4_uninhabited_default_2() { - // CHECK-LABEL: fn otherwise_t4_uninhabited_default_2( +// EMIT_MIR unreachable_enum_branching.otherwise_t4_unreachable_default_2.UnreachableEnumBranching.diff +fn otherwise_t4_unreachable_default_2() { + // CHECK-LABEL: fn otherwise_t4_unreachable_default_2( // CHECK: [[discr:_.*]] = discriminant( // CHECK: switchInt(move [[discr]]) -> [0: bb2, 1: bb5, 2: bb6, 3: bb1, otherwise: [[unreachable:bb.*]]]; // CHECK: [[unreachable]]: { @@ -147,7 +147,7 @@ fn otherwise_t4_uninhabited_default_2() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t4.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.otherwise_t4.UnreachableEnumBranching.diff fn otherwise_t4() { // CHECK-LABEL: fn otherwise_t4( // CHECK: [[discr:_.*]] = discriminant( @@ -162,9 +162,9 @@ fn otherwise_t4() { }; } -// EMIT_MIR uninhabited_enum_branching.otherwise_t5_uninhabited_default.UninhabitedEnumBranching.diff -fn otherwise_t5_uninhabited_default() { - // CHECK-LABEL: fn otherwise_t5_uninhabited_default( +// EMIT_MIR unreachable_enum_branching.otherwise_t5_unreachable_default.UnreachableEnumBranching.diff +fn otherwise_t5_unreachable_default() { + // CHECK-LABEL: fn otherwise_t5_unreachable_default( // CHECK: [[discr:_.*]] = discriminant( // CHECK: switchInt(move [[discr]]) -> [255: bb2, 0: bb3, 5: bb4, 3: bb1, otherwise: [[unreachable:bb.*]]]; // CHECK: [[unreachable]]: { @@ -177,7 +177,7 @@ fn otherwise_t5_uninhabited_default() { }; } -// EMIT_MIR uninhabited_enum_branching.byref.UninhabitedEnumBranching.diff +// EMIT_MIR unreachable_enum_branching.byref.UnreachableEnumBranching.diff fn byref() { // CHECK-LABEL: fn byref( let plop = Plop { xx: 51, test3: Test3::C }; @@ -210,9 +210,9 @@ fn main() { otherwise_t1(); otherwise_t2(); otherwise_t3(); - otherwise_t4_uninhabited_default(); - otherwise_t4_uninhabited_default_2(); + otherwise_t4_unreachable_default(); + otherwise_t4_unreachable_default_2(); otherwise_t4(); - otherwise_t5_uninhabited_default::(); + otherwise_t5_unreachable_default::(); byref(); } diff --git a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff similarity index 90% rename from tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.panic-abort.diff rename to tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff index 674d3a25504a9..a85fc0da99232 100644 --- a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff @@ -1,5 +1,5 @@ -- // MIR for `simple` before UninhabitedEnumBranching -+ // MIR for `simple` after UninhabitedEnumBranching +- // MIR for `simple` before UnreachableEnumBranching ++ // MIR for `simple` after UnreachableEnumBranching fn simple() -> () { let mut _0: (); diff --git a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff similarity index 90% rename from tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.panic-unwind.diff rename to tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff index 674d3a25504a9..a85fc0da99232 100644 --- a/tests/mir-opt/uninhabited_enum_branching.simple.UninhabitedEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff @@ -1,5 +1,5 @@ -- // MIR for `simple` before UninhabitedEnumBranching -+ // MIR for `simple` after UninhabitedEnumBranching +- // MIR for `simple` before UnreachableEnumBranching ++ // MIR for `simple` after UnreachableEnumBranching fn simple() -> () { let mut _0: ();