diff options
| author | bors <bors@rust-lang.org> | 2023-11-01 03:17:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-01 03:17:19 +0000 |
| commit | 7fc6365570988286e899684760b5b1d0ec1ed12c (patch) | |
| tree | 381a1c679381df211d2c46e605135b7746ddf274 /compiler/rustc_codegen_llvm/src | |
| parent | 98f5ebbe2e1be26c49c3ecd7cb8e832f0fceed1d (diff) | |
| parent | 35fe75d8f3800a77cf23a6d7b23d9c28311c5dfb (diff) | |
| download | rust-7fc6365570988286e899684760b5b1d0ec1ed12c.tar.gz rust-7fc6365570988286e899684760b5b1d0ec1ed12c.zip | |
Auto merge of #116692 - Nadrieril:half-open-ranges, r=cjgillot
Match usize/isize exhaustively with half-open ranges
The long-awaited finale to the saga of [exhaustiveness checking for integers](https://github.com/rust-lang/rust/pull/50912)!
```rust
match 0usize {
0.. => {} // exhaustive!
}
match 0usize {
0..usize::MAX => {} // helpful error message!
}
```
Features:
- Half-open ranges behave as expected for `usize`/`isize`;
- Trying to use `0..usize::MAX` will tell you that `usize::MAX..` is missing and explain why. No more unhelpful "`_` is missing";
- Everything else stays the same.
This should unblock https://github.com/rust-lang/rust/issues/37854.
Review-wise:
- I recommend looking commit-by-commit;
- This regresses perf because of the added complexity in `IntRange`; hopefully not too much;
- I measured each `#[inline]`, they all help a bit with the perf regression (tho I don't get why);
- I did not touch MIR building; I expect there's an easy PR there that would skip unnecessary comparisons when the range is half-open.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
