diff options
| author | bors <bors@rust-lang.org> | 2020-05-14 06:22:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-14 06:22:40 +0000 |
| commit | 7c34d8d6629506a596215886e5fc4bb2b04b00ae (patch) | |
| tree | 9a7536b7fc39a340e7bf4d9d72c7c43485321fc0 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 23ffeea307c31f0c20ebb5a15d5171e0c414629d (diff) | |
| parent | 6de6d70ae0a21b779d63d885438c7214e17e7a6d (diff) | |
| download | rust-7c34d8d6629506a596215886e5fc4bb2b04b00ae.tar.gz rust-7c34d8d6629506a596215886e5fc4bb2b04b00ae.zip | |
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
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
