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