summary refs log tree commit diff
path: root/src/test/run-pass/enum-variants.rs
blob: 69f3c8813883aa44425bfedfb0d35a83f6b58d2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#[allow(dead_assignment)];
#[allow(unused_variable)];
#[feature(struct_variant)];

enum Animal {
    Dog (~str, f64),
    Cat { name: ~str, weight: f64 }
}

pub fn main() {
    let mut a: Animal = Dog(~"Cocoa", 37.2);
    a = Cat{ name: ~"Spotty", weight: 2.7 };
    // permuting the fields should work too
    let _c = Cat { weight: 3.1, name: ~"Spreckles" };
}