2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2014-02-28 23:35:10 -05:00
|
|
|
// Destructuring struct variants would ICE where regular structs wouldn't
|
|
|
|
|
|
|
|
enum Foo {
|
2015-03-25 17:06:52 -07:00
|
|
|
VBar { num: isize }
|
2014-02-28 23:35:10 -05:00
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
struct SBar { num: isize }
|
2014-02-28 23:35:10 -05:00
|
|
|
|
|
|
|
pub fn main() {
|
2014-11-06 00:05:53 -08:00
|
|
|
let vbar = Foo::VBar { num: 1 };
|
|
|
|
let Foo::VBar { num } = vbar;
|
2014-02-28 23:35:10 -05:00
|
|
|
assert_eq!(num, 1);
|
|
|
|
|
|
|
|
let sbar = SBar { num: 2 };
|
|
|
|
let SBar { num } = sbar;
|
|
|
|
assert_eq!(num, 2);
|
|
|
|
}
|