1 // run-pass
2 #![allow(unused_parens)]
3 #![allow(non_camel_case_types)]
4 
5 
6 enum colour { red(isize, isize), green, }
7 
8 impl PartialEq for colour {
eq(&self, other: &colour) -> bool9     fn eq(&self, other: &colour) -> bool {
10         match *self {
11             colour::red(a0, b0) => {
12                 match (*other) {
13                     colour::red(a1, b1) => a0 == a1 && b0 == b1,
14                     colour::green => false,
15                 }
16             }
17             colour::green => {
18                 match (*other) {
19                     colour::red(..) => false,
20                     colour::green => true
21                 }
22             }
23         }
24     }
ne(&self, other: &colour) -> bool25     fn ne(&self, other: &colour) -> bool { !(*self).eq(other) }
26 }
27 
f()28 fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); }
29 
main()30 pub fn main() { f(); }
31