Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #69756 - wesleywiser:simplify_try, r=oli-obk
Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1 I also added test cases to make sure the optimization can fire on all of these cases: ```rust fn case_1(o: Option<u8>) -> Option<u8> { match o { Some(u) => Some(u), None => None, } } fn case2(r: Result<u8, i32>) -> Result<u8, i32> { match r { Ok(u) => Ok(u), Err(i) => Err(i), } } fn case3(r: Result<u8, i32>) -> Result<u8, i32> { let u = r?; Ok(u) } ``` Without MIR inlining, this still does not completely optimize away the `?` operator because the `Try::into_result()`, `From::from()` and `Try::from_error()` calls still exist. This does move us a bit closer to that goal though because: - We can now run the pass on mir-opt-level=1 - We no longer depend on the copy propagation pass running which is unlikely to stabilize anytime soon. Fixes #66855
- Loading branch information