]> git.proxmox.com Git - rustc.git/blob - tests/ui/structs-enums/enum-variants.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / structs-enums / enum-variants.rs
1 // run-pass
2 #![allow(dead_code)]
3 #![allow(unused_assignments)]
4 // pretty-expanded FIXME #23616
5
6 #![allow(unused_variables)]
7
8 enum Animal {
9 Dog (String, f64),
10 Cat { name: String, weight: f64 }
11 }
12
13 pub fn main() {
14 let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2);
15 a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 };
16 // permuting the fields should work too
17 let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_string() };
18 }