rust/src/test/compile-fail/borrowck-mut-deref-comp.rs
2012-07-25 05:45:52 -07:00

9 lines
258 B
Rust

enum foo = ~int;
fn borrow(x: @mut foo) {
let _y = &***x; //~ ERROR illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
*x = foo(~4); //~ NOTE impure due to assigning to dereference of mutable @ pointer
}
fn main() {
}