]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add regression test
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 11 Oct 2023 12:40:18 +0000 (14:40 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:14 +0000 (19:09 +0100)
This new test highlight the fix for issue #2657.

gcc/testsuite/ChangeLog:

* rust/compile/match_break.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/testsuite/rust/compile/match_break.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/match_break.rs b/gcc/testsuite/rust/compile/match_break.rs
new file mode 100644 (file)
index 0000000..d5aca86
--- /dev/null
@@ -0,0 +1,14 @@
+// { dg-additional-options "-frust-compile-until=ast" }
+enum Nat {
+    S(Box<Nat>),
+    Z,
+}
+fn test(x: &mut Nat) {
+    let mut p = &mut *x;
+    loop {
+        match p {
+            &mut Nat::Z => break,
+            &mut Nat::S(ref mut n) => p = &mut *n,
+        }
+    }
+}