diff options
| author | bors <bors@rust-lang.org> | 2016-01-04 03:07:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-01-04 03:07:59 +0000 |
| commit | 191ff2d8fd57a8238d85302a8f06e2bd11b2f6d2 (patch) | |
| tree | aee842f40ee54d842461d48f1c70c3f6aaeedf34 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 99e59dec5a8781817b4a1858535b1ffe11b8f735 (diff) | |
| parent | add7410af6741ab5f7c8001f25c8f794fa7092a8 (diff) | |
| download | rust-191ff2d8fd57a8238d85302a8f06e2bd11b2f6d2.tar.gz rust-191ff2d8fd57a8238d85302a8f06e2bd11b2f6d2.zip | |
Auto merge of #30651 - nagisa:mir-fix-equality-checks, r=eddyb
This is not a fix to checks themselves per se (though we still use `Eq` MIR test instead of calling `PartialEq::eq`), but rather how we handle items we encounter in pattern position.
Previously we would just call `PartialEq` with the constant and the matchee, but now we essentially inline the constant instead. E.g. these two snippets are functionally equivalent at MIR level:
```
match val { Some(42) => true, _ => false }
```
and
```
const SECRET: Option<u8> = Some(42);
match val { SECRET => true, _ => false }
```
This approach also allows for more optimizations of matches. I.e. It can now exploit `SwitchInt` to switch on number inside a `Some` regardless of whether the value being an item or not.
This is based on @tsion’s already approved PR so I could reuse the file for more tests.
r? @eddyb
cc @nikomatsakis @tsion
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
