]> git.proxmox.com Git - rustc.git/blob - src/test/ui/structs-enums/tag.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / structs-enums / tag.rs
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 {
9 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 }
25 fn ne(&self, other: &colour) -> bool { !(*self).eq(other) }
26 }
27
28 fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); }
29
30 pub fn main() { f(); }