about summary refs log tree commit diff
path: root/tests/ui/pattern/struct-field-duplicate-binding-15260.rs
blob: a3617798cdfbb2e3d9c81eb3ad5507e25908d2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//! Regression test for https://github.com/rust-lang/rust/issues/15260

struct Foo {
    a: usize,
}

fn main() {
    let Foo {
        a: _,
        a: _
        //~^ ERROR field `a` bound multiple times in the pattern
    } = Foo { a: 29 };

    let Foo {
        a,
        a: _
        //~^ ERROR field `a` bound multiple times in the pattern
    } = Foo { a: 29 };

    let Foo {
        a,
        a: _,
        //~^ ERROR field `a` bound multiple times in the pattern
        a: x
        //~^ ERROR field `a` bound multiple times in the pattern
    } = Foo { a: 29 };
}