2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(unused_assignments)]
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2016-08-13 02:41:43 -07:00
|
|
|
#![allow(unused_variables)]
|
2013-08-17 08:37:42 -07:00
|
|
|
|
2012-12-20 00:02:46 -07:00
|
|
|
enum Animal {
|
2014-05-22 16:57:53 -07:00
|
|
|
Dog (String, f64),
|
|
|
|
Cat { name: String, weight: f64 }
|
2012-12-20 00:02:46 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2014-11-06 00:05:53 -08:00
|
|
|
let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2);
|
|
|
|
a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 };
|
2012-12-20 00:02:46 -07:00
|
|
|
// permuting the fields should work too
|
2014-11-06 00:05:53 -08:00
|
|
|
let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_string() };
|
2012-12-20 00:02:46 -07:00
|
|
|
}
|