From 4c835425d056444a2fc3d13d9aa0625c445189a2 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 11 Oct 2023 14:40:18 +0200 Subject: [PATCH] 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 --- gcc/testsuite/rust/compile/match_break.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/rust/compile/match_break.rs diff --git a/gcc/testsuite/rust/compile/match_break.rs b/gcc/testsuite/rust/compile/match_break.rs new file mode 100644 index 000000000000..d5aca86e8a4f --- /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), + 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, + } + } +} -- 2.47.2