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