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

8 lines
220 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); }