]> git.proxmox.com Git - rustc.git/blame - src/test/ui/inline-const/const-match-pat-generic.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / inline-const / const-match-pat-generic.rs
CommitLineData
94222f64 1#![allow(incomplete_features)]
3c0e092e 2#![feature(inline_const_pat)]
94222f64
XL
3
4// rust-lang/rust#82518: ICE with inline-const in match referencing const-generic parameter
5
6fn foo<const V: usize>() {
a2a8927a
XL
7 match 0 {
8 const { V } => {},
923072b8
FG
9 //~^ ERROR constant pattern depends on a generic parameter
10 //~| ERROR constant pattern depends on a generic parameter
a2a8927a
XL
11 _ => {},
12 }
13}
14
15const fn f(x: usize) -> usize {
16 x + 1
17}
18
04454e1e 19fn bar<const V: usize>() {
a2a8927a
XL
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 }
94222f64
XL
26}
27
28fn main() {
29 foo::<1>();
a2a8927a 30 bar::<1>();
94222f64 31}