rust/compiler/rustc_feature/src
Matthias Krüger 81b6263dd0
Rollup merge of #118598 - Nadrieril:remove_precise_pointer_size_matching, r=davidtwco
Remove the `precise_pointer_size_matching` feature gate

`usize` and `isize` are special for pattern matching because their range might depend on the platform. To make code portable across platforms, the following is never considered exhaustive:
```rust
let x: usize = ...;
match x {
    0..=18446744073709551615 => {}
}
```
Because of how rust handles constants, this also unfortunately counts `0..=usize::MAX` as non-exhaustive. The [`precise_pointer_size_matching`](https://github.com/rust-lang/rust/issues/56354) feature gate was introduced both for this convenience and for the possibility that the lang team could decide to allow the above.

Since then, [half-open range patterns](https://github.com/rust-lang/rust/issues/67264) have been implemented, and since #116692 they correctly support `usize`/`isize`:
```rust
match 0usize { // exhaustive!
    0..5 => {}
    5.. => {}
}
```
I believe this subsumes all the use cases of the feature gate. Moreover no attempt has been made to stabilize it in the 5 years of its existence. I therefore propose we retire this feature gate.

Closes https://github.com/rust-lang/rust/issues/56354
2023-12-05 16:08:35 +01:00
..
accepted.rs Auto merge of #117472 - jmillikin:stable-c-str-literals, r=Nilstrieb 2023-12-01 13:33:55 +00:00
builtin_attrs.rs Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug. 2023-12-02 09:01:19 +11:00
lib.rs Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
removed.rs Remove the precise_pointer_size_matching feature gate 2023-12-04 11:56:21 +01:00
tests.rs tidy: Re-enable check for inline unit tests 2020-12-12 19:18:44 +03:00
unstable.rs Remove the precise_pointer_size_matching feature gate 2023-12-04 11:56:21 +01:00