summaryrefslogtreecommitdiffstats
path: root/tests/ui/pattern/issue-11577.rs
blob: 70177c5ed0d365cdd33600e9788c7ad25358ef95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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);
}