aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/match_break.rs
blob: d5aca86e8a4f6ef4b5afec99efb18b8b80bd1427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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,
        }
    }
}