You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A problem with inline_const feature in ranges #78108
As soon as I've seen the new inline_const feature, I've tried to find some use cases for it in my code, and I did find only very few of them, unfortunately, and one of the two uses cases could be reduced to this:
error: expected one of `=>`, `if`, or `|`, found keyword `const`
--> ...\temp.rs:9:14
|
9 | 1 .. const{N - 1} => {},
| ^^^^^ expected one of `=>`, `if`, or `|`
error[E0658]: half-open range patterns are unstable
--> ...\temp.rs:9:9
|
9 | 1 .. const{N - 1} => {},
| ^^^^
|
= note:see issue #67264 <https://github.com/rust-lang/rust/issues/67264> for more information
= help: add `#![feature(half_open_range_patterns)]` to the crate attributes to enable
So I am not sure if this is a bug report or an enhancement request.
Support for ranges in patterns (1 .. const { 2 } or const { 1 } .. 2) needs to be added separately, to fn parse_pat_range_end and fn parse_pat_with_range_pat respectively.
Activity
camelid commentedon Oct 19, 2020
Note that this does work in expressions (playground):
petrochenkov commentedon Oct 19, 2020
Support for ranges in patterns (
1 .. const { 2 }orconst { 1 } .. 2) needs to be added separately, tofn parse_pat_range_endandfn parse_pat_with_range_patrespectively.spastorino commentedon Oct 19, 2020
Ohh I've just realized that we had this issue opened, I've fixed this in #78116.
Going to adjust description of the PR accordingly so it closes this issue when merged.
Rollup merge of rust-lang#78116 - spastorino:inline-const-in-range-pa…
Rollup merge of rust-lang#78116 - spastorino:inline-const-in-range-pa…