1 #![feature(control_flow_enum)]
2 #![feature(try_trait_v2)]
4 use std::ops::ControlFlow;
6 // EMIT_MIR separate_const_switch.too_complex.SeparateConstSwitch.diff
7 // EMIT_MIR separate_const_switch.too_complex.ConstProp.diff
8 // EMIT_MIR separate_const_switch.too_complex.PreCodegen.after.mir
9 fn too_complex(x: Result<i32, usize>) -> Option<i32> {
10 // The pass should break the outer match into
11 // two blocks that only have one parent each.
12 // Parents are one of the two branches of the first
13 // match, so a later pass can propagate constants.
16 Ok(v) => ControlFlow::Continue(v),
17 Err(r) => ControlFlow::Break(r),
20 ControlFlow::Continue(v) => Some(v),
21 ControlFlow::Break(r) => None,
25 // EMIT_MIR separate_const_switch.identity.SeparateConstSwitch.diff
26 // EMIT_MIR separate_const_switch.identity.ConstProp.diff
27 // EMIT_MIR separate_const_switch.identity.PreCodegen.after.mir
28 fn identity(x: Result<i32, i32>) -> Result<i32, i32> {