-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-parserparser issuesparser issuesS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
I tried the following code:
#![allow(incomplete_features)]
#![allow(unused)]
#![feature(inline_const)]
#[repr(u8)]
enum Foo {
Bar,
Baz,
Qux
}
fn main() {
let x = const { Foo::Bar as u8 };
// 0
println!("{}", x);
let bytes = [0, 4, 3];
// Yes
match bytes[0] {
const { Foo::Bar as u8 } => println!("Yes"),
const { Foo::Baz as u8 } | const { Foo::Qux as u8 } => println!("No!"),
_ => panic!("not a valid Foo!")
}
}rustc (1.50.0-nightly (2225ee1 2020-12-11)) successfully compiles this, producing no warnings. Running the produced binary yields the expected output:
0
Yes
However, rust-analyzer (2020-11-16 (e8c8039), I was not able to install the nightly version) believes that the const blocks are syntax errors:
I understand if this is expected behaviour since inline_const is an incomplete/unstable feature.
Metadata
Metadata
Assignees
Labels
A-parserparser issuesparser issuesS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now

