rust/src/test/compile-fail/unsafe-mutable-alias.rs

9 lines
223 B
Rust
Raw Normal View History

// error-pattern:mutable alias to a variable that roots another alias
fn f(a: {mutable x: int}, b: &mutable {mutable x: int}) -> int {
b.x += 1;
ret a.x + b.x;
}
fn main() { let i = {mutable x: 4}; log f(i, i); }