summaryrefslogtreecommitdiffstats
path: root/tests/ui/const-generics/arg-in-pat-1.rs
blob: 82555084e418f13c3112f2781b012a36ceafb8ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// check-pass
enum ConstGenericEnum<const N: usize> {
    Foo([i32; N]),
    Bar,
}

fn foo<const N: usize>(val: &ConstGenericEnum<N>) {
    if let ConstGenericEnum::<N>::Foo(field, ..) = val {}
}

fn bar<const N: usize>(val: &ConstGenericEnum<N>) {
    match val {
        ConstGenericEnum::<N>::Foo(field, ..) => (),
        ConstGenericEnum::<N>::Bar => (),
    }
}

fn main() {
    match ConstGenericEnum::Bar {
        ConstGenericEnum::<3>::Foo(field, ..) => (),
        ConstGenericEnum::<3>::Bar => (),
    }
}