2012-06-08 09:46:14 -05:00
|
|
|
enum cycle {
|
|
|
|
node({mut a: ~cycle}),
|
|
|
|
empty
|
|
|
|
}
|
|
|
|
fn main() {
|
|
|
|
let x = ~node({mut a: ~empty});
|
|
|
|
// Create a cycle!
|
2012-08-23 16:44:58 -05:00
|
|
|
match *x { //~ NOTE loan of immutable local variable granted here
|
2012-08-07 08:04:36 -05:00
|
|
|
node(ref y) => {
|
2012-10-23 13:11:23 -05:00
|
|
|
y.a = move x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
2012-06-08 09:46:14 -05:00
|
|
|
}
|
2012-08-23 16:44:58 -05:00
|
|
|
empty => {}
|
2012-06-08 09:46:14 -05:00
|
|
|
};
|
2012-08-07 08:04:36 -05:00
|
|
|
}
|