summary refs log tree commit diff
path: root/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
blob: beab4d3409e1af93446098f48d742f45bca2e0b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
enum cycle {
    node({mut a: ~cycle}),
    empty
}
fn main() {
    let x = ~node({mut a: ~empty});
    // Create a cycle!
    match *x { //~ NOTE loan of immutable local variable granted here
      node(ref y) => {
        y.a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
      }
      empty => {}
    };
}