aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-10-11 14:40:18 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:09:14 +0100
commit4c835425d056444a2fc3d13d9aa0625c445189a2 (patch)
treeed672ec10b3ecab5357d7e0e2692e87d1d15b94d /gcc
parent863431f5a0a7e208937ee471a6f0933df214cdd8 (diff)
downloadgcc-4c835425d056444a2fc3d13d9aa0625c445189a2.zip
gcc-4c835425d056444a2fc3d13d9aa0625c445189a2.tar.gz
gcc-4c835425d056444a2fc3d13d9aa0625c445189a2.tar.bz2
gccrs: Add regression test
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/rust/compile/match_break.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/match_break.rs b/gcc/testsuite/rust/compile/match_break.rs
new file mode 100644
index 0000000..d5aca86
--- /dev/null
+++ b/gcc/testsuite/rust/compile/match_break.rs
@@ -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,
+ }
+ }
+}