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

9 lines
215 B
Rust
Raw Normal View History

2012-03-26 20:35:18 -05:00
// error-pattern:mut reference to a variable that roots another reference
2012-03-26 20:35:18 -05:00
fn f(a: {mut x: int}, &b: {mut x: int}) -> int {
b.x += 1;
ret a.x + b.x;
}
2012-03-26 20:35:18 -05:00
fn main() { let i = {mut x: 4}; log(debug, f(i, i)); }