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

11 lines
233 B
Rust
Raw Normal View History

// error-pattern:may alias with argument
2012-03-26 18:35:18 -07:00
fn foo(x: {mut x: int}, f: fn@()) { log(debug, x); }
2012-03-26 18:35:18 -07:00
fn whoknows(x: @mut {mut x: int}) { *x = {mut x: 10}; }
fn main() {
2012-03-26 18:35:18 -07:00
let box = @mut {mut x: 1};
foo(*box, bind whoknows(box));
}