summaryrefslogtreecommitdiffstats
path: root/tests/ui/box/unit/unique-pat-2.rs
blob: 9c73fd2204c382ed6f9c8b8c58f6adf8df66e0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#![allow(non_shorthand_field_patterns)]

#![feature(box_patterns)]

struct Foo {a: isize, b: usize}

enum bar { u(Box<Foo>), w(isize), }

pub fn main() {
    let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) {
        bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) }
        _ => { 66 }
    };
    assert_eq!(v, 50);
}