mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-11 08:05:12 +00:00
19 lines
353 B
Rust
19 lines
353 B
Rust
//@ run-pass
|
|
// Destructuring struct variants would ICE where regular structs wouldn't
|
|
|
|
enum Foo {
|
|
VBar { num: isize }
|
|
}
|
|
|
|
struct SBar { num: isize }
|
|
|
|
pub fn main() {
|
|
let vbar = Foo::VBar { num: 1 };
|
|
let Foo::VBar { num } = vbar;
|
|
assert_eq!(num, 1);
|
|
|
|
let sbar = SBar { num: 2 };
|
|
let SBar { num } = sbar;
|
|
assert_eq!(num, 2);
|
|
}
|