summaryrefslogtreecommitdiffstats
path: root/tests/ui/associated-consts/associated-const-type-parameter-arms.rs
blob: 3f260d84e4c0a03da4929c134e48833e55becab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub enum EFoo { A, B, C, D }

pub trait Foo {
    const X: EFoo;
}

struct Abc;

impl Foo for Abc {
    const X: EFoo = EFoo::B;
}

struct Def;
impl Foo for Def {
    const X: EFoo = EFoo::D;
}

pub fn test<A: Foo, B: Foo>(arg: EFoo) {
    match arg {
        A::X => println!("A::X"),
        //~^ error: associated consts cannot be referenced in patterns [E0158]
        B::X => println!("B::X"),
        //~^ error: associated consts cannot be referenced in patterns [E0158]
        _ => (),
    }
}

fn main() {
}