mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
21 lines
335 B
Rust
21 lines
335 B
Rust
struct Node_ {
|
|
a: Box<Cycle>
|
|
}
|
|
|
|
enum Cycle {
|
|
Node(Node_),
|
|
Empty,
|
|
}
|
|
|
|
fn main() {
|
|
let mut x: Box<_> = Box::new(Cycle::Node(Node_ {a: Box::new(Cycle::Empty)}));
|
|
|
|
// Create a cycle!
|
|
match *x {
|
|
Cycle::Node(ref mut y) => {
|
|
y.a = x; //~ ERROR cannot move out of
|
|
}
|
|
Cycle::Empty => {}
|
|
};
|
|
}
|