diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-07-24 19:07:20 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-08-09 16:27:20 +0500 |
| commit | 16765639b30741dde85da0dbcb44c343eb82b1a2 (patch) | |
| tree | ef7f40e32fab78c39546bc588542774d276e5dc8 /tests/ui/pattern/struct-field-duplicate-binding-15260.rs | |
| parent | 90bb5cacb5c1a5fe20ba821d28e7eb7a21e35d09 (diff) | |
| download | rust-16765639b30741dde85da0dbcb44c343eb82b1a2.tar.gz rust-16765639b30741dde85da0dbcb44c343eb82b1a2.zip | |
comments
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 }; +} |
