rust/src/test/compile-fail/unsafe-mutable-alias.rs
2012-03-26 18:35:18 -07:00

9 lines
215 B
Rust

// 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)); }