]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const_in_pattern/custom-eq-branch-pass.rs
Rollup merge of #98609 - TaKO8Ki:fix-ice-for-associated-constant-generics, r=lcnr
[rust.git] / src / test / ui / consts / const_in_pattern / custom-eq-branch-pass.rs
1 // run-pass
2
3 #![warn(indirect_structural_match)]
4
5 struct CustomEq;
6
7 impl Eq for CustomEq {}
8 impl PartialEq for CustomEq {
9     fn eq(&self, _: &Self) -> bool {
10         false
11     }
12 }
13
14 #[derive(PartialEq, Eq)]
15 enum Foo {
16     Bar,
17     Baz,
18     Qux(CustomEq),
19 }
20
21 const BAR_BAZ: Foo = if 42 == 42 {
22     Foo::Bar
23 } else {
24     Foo::Baz
25 };
26
27 fn main() {
28     match Foo::Qux(CustomEq) {
29         BAR_BAZ => panic!(),
30         _ => {}
31     }
32 }