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

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

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