summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const_in_pattern/issue-62614.rs
blob: 4ea9a283618ea385cbacee8610916f8b6616e9d7 (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
// run-pass

struct Sum(u32, u32);

impl PartialEq for Sum {
    fn eq(&self, other: &Self) -> bool { self.0 + self.1 == other.0 + other.1 }
}

impl Eq for Sum { }

#[derive(PartialEq, Eq)]
enum Eek {
    TheConst,
    UnusedByTheConst(Sum)
}

const THE_CONST: Eek = Eek::TheConst;

pub fn main() {
    match Eek::UnusedByTheConst(Sum(1,2)) {
        THE_CONST => { panic!(); }
        _ => {}
    }
}