Add test for issue 82518
This commit is contained in:
parent
53a7cdd9a3
commit
dc52040efd
16
src/test/ui/inline-const/const-match-pat-generic.rs
Normal file
16
src/test/ui/inline-const/const-match-pat-generic.rs
Normal 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>();
|
||||
}
|
9
src/test/ui/inline-const/const-match-pat-generic.stderr
Normal file
9
src/test/ui/inline-const/const-match-pat-generic.stderr
Normal 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`.
|
Loading…
x
Reference in New Issue
Block a user