Closed
Description
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:
#![allow(incomplete_features)]
#![feature(inline_const)]
fn main() {
const N: u32 = 10;
let x: u32 = 3;
match x {
1 .. const { N - 1 } => {},
_ => {},
}
}
That gives errors:
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Area: The parsing of Rust source code to an ASTArea: The parsing of Rust source code to an ASTRelating to patterns and pattern matchingRelating to patterns and pattern matchingCategory: This is a bug.Category: This is a bug.Inline constants (aka: const blocks, const expressions, anonymous constants)Inline constants (aka: const blocks, const expressions, anonymous constants)Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.