Add test for issue 82518

This commit is contained in:
Gary Guo 2021-08-14 18:29:04 +01:00
parent 53a7cdd9a3
commit dc52040efd
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#![allow(incomplete_features)]
#![feature(inline_const)]
// rust-lang/rust#82518: ICE with inline-const in match referencing const-generic parameter
fn foo<const V: usize>() {
match 0 {
const { V } => {},
//~^ ERROR const parameters cannot be referenced in patterns [E0158]
_ => {},
}
}
fn main() {
foo::<1>();
}

View File

@ -0,0 +1,9 @@
error[E0158]: const parameters cannot be referenced in patterns
--> $DIR/const-match-pat-generic.rs:8:11
|
LL | const { V } => {},
| ^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0158`.