]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs-enums/enum-variants.rs
Rollup merge of #93112 - pietroalbini:pa-cve-2022-21658-nightly, r=pietroalbini
[rust.git] / src / test / 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 }