about summary refs log tree commit diff
path: root/tests/ui/pattern/struct-field-duplicate-binding-15260.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-10 19:45:48 +1000
committerGitHub <noreply@github.com>2025-08-10 19:45:48 +1000
commit62b406d4b185f28828df3e0df6b1aa1f560145df (patch)
treea3720e028c717f4136e1e555311c436c2a84aeb0 /tests/ui/pattern/struct-field-duplicate-binding-15260.rs
parent5955f005e53234b71f77d33040b973e6b9551db3 (diff)
parent16765639b30741dde85da0dbcb44c343eb82b1a2 (diff)
downloadrust-62b406d4b185f28828df3e0df6b1aa1f560145df.tar.gz
rust-62b406d4b185f28828df3e0df6b1aa1f560145df.zip
Rollup merge of #144403 - Kivooeo:issue4, r=jieyouxu
`tests/ui/issues/`: The Issues Strike Back [4/N]

Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895.

r? ````````@jieyouxu````````
Diffstat (limited to 'tests/ui/pattern/struct-field-duplicate-binding-15260.rs')
-rw-r--r--tests/ui/pattern/struct-field-duplicate-binding-15260.rs27
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 };
+}