From 9ddb362bc0b6183c64332f853f6364fdd97cd605 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 11 Oct 2023 14:40:18 +0200 Subject: 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 (limited to 'gcc') 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), + 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, + } + } +} -- cgit v1.1