mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
18 lines
244 B
Rust
18 lines
244 B
Rust
// check-pass
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {}
|