]> git.proxmox.com Git - rustc.git/blob - tests/ui/associated-consts/associated-const-type-parameter-arms.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / associated-consts / associated-const-type-parameter-arms.rs
1 pub enum EFoo { A, B, C, D }
2
3 pub trait Foo {
4 const X: EFoo;
5 }
6
7 struct Abc;
8
9 impl Foo for Abc {
10 const X: EFoo = EFoo::B;
11 }
12
13 struct Def;
14 impl Foo for Def {
15 const X: EFoo = EFoo::D;
16 }
17
18 pub fn test<A: Foo, B: Foo>(arg: EFoo) {
19 match arg {
20 A::X => println!("A::X"),
21 //~^ error: associated consts cannot be referenced in patterns [E0158]
22 B::X => println!("B::X"),
23 //~^ error: associated consts cannot be referenced in patterns [E0158]
24 _ => (),
25 }
26 }
27
28 fn main() {
29 }