rust/tests/ui/borrowck/issue-10876.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
244 B
Rust
Raw Normal View History

// check-pass
2019-02-25 23:07:12 +00:00
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() {}