rust/src/test/compile-fail/mutable-huh-ptr-assign.rs
2011-10-17 16:35:33 -07:00

17 lines
258 B
Rust

// error-pattern: assigning to immutable box
use std;
fn main() {
unsafe fn f(&&v: *mutable? int) {
// This shouldn't be possible
*v = 1
}
unsafe {
let a = 0;
let v = std::ptr::addr_of(a);
f(v);
}
}