2021-08-14 17:29:04 +00:00
|
|
|
#![allow(incomplete_features)]
|
2021-11-22 16:25:28 +00:00
|
|
|
#![feature(inline_const_pat)]
|
2021-08-14 17:29:04 +00:00
|
|
|
|
|
|
|
// rust-lang/rust#82518: ICE with inline-const in match referencing const-generic parameter
|
|
|
|
|
|
|
|
fn foo<const V: usize>() {
|
2021-12-05 21:38:37 +00:00
|
|
|
match 0 {
|
|
|
|
const { V } => {},
|
2022-04-12 16:14:28 +00:00
|
|
|
//~^ ERROR constant pattern depends on a generic parameter
|
2021-12-05 21:38:37 +00:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const fn f(x: usize) -> usize {
|
|
|
|
x + 1
|
|
|
|
}
|
|
|
|
|
2022-04-29 14:27:59 +00:00
|
|
|
fn bar<const V: usize>() {
|
2021-12-05 21:38:37 +00:00
|
|
|
match 0 {
|
|
|
|
const { f(V) } => {},
|
|
|
|
//~^ ERROR constant pattern depends on a generic parameter
|
|
|
|
_ => {},
|
|
|
|
}
|
2021-08-14 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo::<1>();
|
2021-12-05 21:38:37 +00:00
|
|
|
bar::<1>();
|
2021-08-14 17:29:04 +00:00
|
|
|
}
|