]> git.proxmox.com Git - rustc.git/blob - tests/ui/inline-const/const-match-pat-generic.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / inline-const / const-match-pat-generic.rs
1 #![allow(incomplete_features)]
2 #![feature(inline_const_pat)]
3
4 // rust-lang/rust#82518: ICE with inline-const in match referencing const-generic parameter
5
6 fn foo<const V: usize>() {
7 match 0 {
8 const { V } => {},
9 //~^ ERROR constant pattern depends on a generic parameter
10 //~| ERROR constant pattern depends on a generic parameter
11 _ => {},
12 }
13 }
14
15 const fn f(x: usize) -> usize {
16 x + 1
17 }
18
19 fn bar<const V: usize>() {
20 match 0 {
21 const { f(V) } => {},
22 //~^ ERROR constant pattern depends on a generic parameter
23 //~| ERROR constant pattern depends on a generic parameter
24 _ => {},
25 }
26 }
27
28 fn main() {
29 foo::<1>();
30 bar::<1>();
31 }