about summary refs log tree commit diff
path: root/tests/ui/binding/pattern-in-closure.rs
blob: 928c179a8b3c8b2061bdee81bba0ca670be6ec6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ run-pass
#![allow(non_shorthand_field_patterns)]

struct Foo {
    x: isize,
    y: isize
}

pub fn main() {
    let f = |(x, _): (isize, isize)| println!("{}", x + 1);
    let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1);
    f((2, 3));
    g(Foo { x: 1, y: 2 });
}