about summary refs log tree commit diff
path: root/tests/ui/pattern/unused-parameters-const-pattern.rs
blob: 107c65ddfd3ae13308ec51bee3183ce9f9b46bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ check-pass

// Tests that const patterns that use generic parameters are
// allowed if we are still able to evaluate them.

trait Trait { const ASSOC: usize; }

impl<T> Trait for T {
    const ASSOC: usize = 10;
}

fn foo<T>(a: usize) {
    match a {
        <T as Trait>::ASSOC => (),
        _ => (),
    }
}

fn main() {}