]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Adds test of issue 1210
authorlenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
Tue, 6 Jan 2026 16:47:47 +0000 (16:47 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 27 Feb 2026 14:57:05 +0000 (15:57 +0100)
Adds new test.

Fixes Rust-GCC/gccrs#1210

gcc/testsuite/ChangeLog:

* rust/compile/issue-1210.rs: New test.

Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
gcc/testsuite/rust/compile/issue-1210.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/issue-1210.rs b/gcc/testsuite/rust/compile/issue-1210.rs
new file mode 100644 (file)
index 0000000..8793958
--- /dev/null
@@ -0,0 +1,26 @@
+enum E {
+    One,
+    Two,
+    Other
+}
+
+fn foo (x: E) -> i32 {
+    let mut y = 0;
+
+    match x {
+        E::One => {
+            y = 1, // { dg-error "expected .;. or .\}. after expression, found .,." "" {target *-*-*} 0 }
+        }
+        E::Two => {
+            y = 2;
+        }
+        _ => {}
+    }
+
+    return y;
+}
+
+fn main () {
+    let x = E::One;
+    let y = foo (x);
+}