diff options
| author | Gary Guo <gary@garyguo.net> | 2021-08-14 18:29:04 +0100 |
|---|---|---|
| committer | Gary Guo <gary@garyguo.net> | 2021-08-16 19:33:49 +0100 |
| commit | dc52040efd3c61ac71b9d837a67ba220d08bc931 (patch) | |
| tree | 37aa8a0195f135875f4b3fc031b99d66a34ed082 | |
| parent | 53a7cdd9a3bd7997730ab800c43f5d1160e670f9 (diff) | |
| download | rust-dc52040efd3c61ac71b9d837a67ba220d08bc931.tar.gz rust-dc52040efd3c61ac71b9d837a67ba220d08bc931.zip | |
Add test for issue 82518
| -rw-r--r-- | src/test/ui/inline-const/const-match-pat-generic.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/inline-const/const-match-pat-generic.stderr | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/inline-const/const-match-pat-generic.rs b/src/test/ui/inline-const/const-match-pat-generic.rs new file mode 100644 index 00000000000..61680d653d0 --- /dev/null +++ b/src/test/ui/inline-const/const-match-pat-generic.rs @@ -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>(); +} diff --git a/src/test/ui/inline-const/const-match-pat-generic.stderr b/src/test/ui/inline-const/const-match-pat-generic.stderr new file mode 100644 index 00000000000..a3ed41a3f6a --- /dev/null +++ b/src/test/ui/inline-const/const-match-pat-generic.stderr @@ -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`. |
