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
This commit is contained in:
commit
81b6263dd0
10 changed files with 33 additions and 86 deletions
|
@ -158,6 +158,9 @@ declare_features! (
|
|||
/// Allows using `#[plugin_registrar]` on functions.
|
||||
(removed, plugin_registrar, "1.54.0", Some(29597), None,
|
||||
Some("plugins are no longer supported")),
|
||||
/// Allows exhaustive integer pattern matching with `usize::MAX`/`isize::MIN`/`isize::MAX`.
|
||||
(removed, precise_pointer_size_matching, "1.32.0", Some(56354), None,
|
||||
Some("removed in favor of half-open ranges")),
|
||||
(removed, proc_macro_expr, "1.27.0", Some(54727), None,
|
||||
Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
|
||||
(removed, proc_macro_gen, "1.27.0", Some(54727), None,
|
||||
|
|
|
@ -543,8 +543,6 @@ declare_features! (
|
|||
(unstable, offset_of_enum, "1.75.0", Some(106655), None),
|
||||
/// Allows using `#[optimize(X)]`.
|
||||
(unstable, optimize_attribute, "1.34.0", Some(54882), None),
|
||||
/// Allows exhaustive integer pattern matching on `usize` and `isize`.
|
||||
(unstable, precise_pointer_size_matching, "1.32.0", Some(56354), None),
|
||||
/// Allows macro attributes on expressions, statements and non-inline modules.
|
||||
(unstable, proc_macro_hygiene, "1.30.0", Some(54727), None),
|
||||
/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue