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, + } + } +}