1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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 => {} }; }