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