summary refs log tree commit diff
path: root/src/test/compile-fail/unsafe-mutable-alias.rs
blob: 3ab7fe974a534cb2f704ffba8d60930cf74fbf51 (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(debug, f(i, i)); }