Skip to content

Commit

Permalink
Add test for issue 82518
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Aug 16, 2021
1 parent 53a7cdd commit dc52040
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/ui/inline-const/const-match-pat-generic.rs
Original file line number Diff line number Diff line change
@@ -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>();
}
9 changes: 9 additions & 0 deletions src/test/ui/inline-const/const-match-pat-generic.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit dc52040

Please sign in to comment.