Skip to content

Commit 4613530

Browse files
committed
Permit usize/isize matching in theory once open-ended range patterns exist
1 parent fb701dc commit 4613530

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

text/0000-exhaustive-integer-pattern-matching.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Summary
77
[summary]: #summary
88

9-
Extend Rust's pattern matching exhaustiveness checks to cover the integer types: `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128` and `char`.
9+
Extend Rust's pattern matching exhaustiveness checks to cover the integer types: `u8`, `u16`, `u32`, `u64`, `u128`, `usize`, `i8`, `i16`, `i32`, `i64`, `i128`, `isize` and `char`.
1010

1111
```rust
1212
fn matcher_full(x: u8) {
@@ -36,7 +36,7 @@ This feature has already [been implemented](https://github.com/rust-lang/rust/pu
3636
# Guide-level explanation
3737
[guide-level-explanation]: #guide-level-explanation
3838

39-
Exhaustive pattern matching works for integer types other than `usize` and `isize`, just like any other type. In addition, missing ranges of integers will be reported as errors.
39+
Exhaustive pattern matching works for integer types, just like any other type. In addition, missing ranges of integers will be reported as errors.
4040

4141
```rust
4242
fn matcher_full(x: u8) {
@@ -67,7 +67,7 @@ The implementation of this features uses interval arithmetic and an extension of
6767

6868
This feature has already [been implemented](https://github.com/rust-lang/rust/pull/50912), so the code there may be used for further reference. The source contains detailed comments about the implementation.
6969

70-
Exhaustiveness checking for `usize` and `isize` will be placed behind an unstable feature flag, `exhaustive_pointer_size_matching`.
70+
For `usize` and `isize`, no assumptions about the maximimum value are permitted. To exhaustively match on either pointer-size integer type a wildcard pattern (`_`) must be used (or if [open-ended range patterns are added](https://github.com/rust-lang/rfcs/issues/947), ranges must be open ended [e.g. `0..`]). An unstable feature `precise_pointer_size_matching` will be added to permit matching exactly on pointer-size integer types.
7171

7272
# Drawbacks
7373
[drawbacks]: #drawbacks

0 commit comments

Comments
 (0)