diff options
Diffstat (limited to 'tests/ui/pattern/struct-field-duplicate-binding-15260.rs')
| -rw-r--r-- | tests/ui/pattern/struct-field-duplicate-binding-15260.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/pattern/struct-field-duplicate-binding-15260.rs b/tests/ui/pattern/struct-field-duplicate-binding-15260.rs new file mode 100644 index 00000000000..a3617798cdf --- /dev/null +++ b/tests/ui/pattern/struct-field-duplicate-binding-15260.rs @@ -0,0 +1,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 }; +} |
