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

17 lines
237 B
Rust
Raw Normal View History

// error-pattern: mismatched types
extern mod std;
fn main() {
let a = ~[0];
let v: *mut ~[int] = ptr::mut_addr_of(a);
fn f(&&v: *mut ~[const int]) {
unsafe {
*v = ~[mut 3]
}
}
f(v);
}