Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
P-E-P committed Oct 11, 2023
1 parent c562576 commit e42ffe4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions gcc/testsuite/rust/compile/match_break.rs
Original file line number Diff line number Diff line change
@@ -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,
}
}
}

0 comments on commit e42ffe4

Please sign in to comment.