1 // compile-flags: -Z mir-opt-level=3 -Zunsound-mir-opts
2 // EMIT_MIR simplify_arm.id.SimplifyArmIdentity.diff
3 // EMIT_MIR simplify_arm.id.SimplifyBranchSame.diff
4 // EMIT_MIR simplify_arm.id_result.SimplifyArmIdentity.diff
5 // EMIT_MIR simplify_arm.id_result.SimplifyBranchSame.diff
6 // EMIT_MIR simplify_arm.id_try.SimplifyArmIdentity.diff
7 // EMIT_MIR simplify_arm.id_try.SimplifyBranchSame.diff
9 // This pass is broken since deaggregation changed
12 fn id(o: Option<u8>) -> Option<u8> {
19 fn id_result(r: Result<u8, i32>) -> Result<u8, i32> {
26 fn into_result<T, E>(r: Result<T, E>) -> Result<T, E> {
30 fn from_error<T, E>(e: E) -> Result<T, E> {
34 // This was written to the `?` from `try_trait`, but `try_trait_v2` uses a different structure,
35 // so the relevant desugar is copied inline in order to keep the test testing the same thing.
36 // FIXME(#85133): while this might be useful for `r#try!`, it would be nice to have a MIR
37 // optimization that picks up the `?` desugaring, as `SimplifyArmIdentity` does not.
38 fn id_try(r: Result<u8, i32>) -> Result<u8, i32> {
39 let x = match into_result(r) {
40 Err(e) => return from_error(From::from(e)),