2 #![allow(non_camel_case_types)]
7 // Tests for if as expressions returning nominal types
13 let rs = if true { I {i: 100} } else { I {i: 101} };
14 assert_eq!(rs.i, 100);
17 #[derive(Copy, Clone, Debug)]
18 enum mood { happy, sad, }
20 impl PartialEq for mood {
21 fn eq(&self, other: &mood) -> bool {
22 ((*self) as usize) == ((*other) as usize)
24 fn ne(&self, other: &mood) -> bool { !(*self).eq(other) }
28 let rs = if true { mood::happy } else { mood::sad };
29 assert_eq!(rs, mood::happy);
32 pub fn main() { test_rec(); test_tag(); }