rust/src/test/compile-fail/mutable-huh-ptr-assign.rs

14 lines
231 B
Rust

extern mod std;
fn main() {
unsafe fn f(&&v: *const int) {
*v = 1 //~ ERROR assigning to dereference of const * pointer
}
unsafe {
let a = 0;
let v = ptr::mut_addr_of(a);
f(v);
}
}