about summary refs log tree commit diff
path: root/src/test/compile-fail/unsafe-mutable-alias.rs
blob: f6b52bef34b4c21bccd6f8090659e6a6694c1105 (plain)
1
2
3
4
5
6
7
8
// error-pattern:mutable reference to a variable that roots another reference

fn f(a: {mutable x: int}, &b: {mutable x: int}) -> int {
    b.x += 1;
    ret a.x + b.x;
}

fn main() { let i = {mutable x: 4}; log f(i, i); }