2 #![allow(non_camel_case_types)]
7 // Tests for match as expressions resulting in struct types
12 let rs = match true { true => R {i: 100}, _ => panic!() };
13 assert_eq!(rs.i, 100);
16 #[derive(Copy, Clone, Debug)]
17 enum mood { happy, sad, }
19 impl PartialEq for mood {
20 fn eq(&self, other: &mood) -> bool {
21 ((*self) as usize) == ((*other) as usize)
23 fn ne(&self, other: &mood) -> bool { !(*self).eq(other) }
27 let rs = match true { true => { mood::happy } false => { mood::sad } };
28 assert_eq!(rs, mood::happy);
31 pub fn main() { test_rec(); test_tag(); }