2012-06-08 07:46:14 -07:00
|
|
|
enum cycle {
|
|
|
|
node({mut a: ~cycle}),
|
|
|
|
empty
|
|
|
|
}
|
|
|
|
fn main() {
|
|
|
|
let x = ~node({mut a: ~empty});
|
|
|
|
// Create a cycle!
|
2012-08-06 12:34:08 -07:00
|
|
|
match check *x { //~ NOTE loan of immutable local variable granted here
|
2012-08-07 06:04:36 -07:00
|
|
|
node(ref y) => {
|
2012-06-30 12:23:59 +01:00
|
|
|
y.a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
|
2012-06-08 07:46:14 -07:00
|
|
|
}
|
|
|
|
};
|
2012-08-07 06:04:36 -07:00
|
|
|
}
|