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

9 lines
242 B
Rust
Raw Normal View History

// error-pattern:mutable reference to a variable that roots another reference
2011-09-12 12:39:38 +02:00
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_full(core::debug, f(i, i)); }