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

17 lines
226 B
Rust
Raw Normal View History

// error-pattern: mismatched types
use std;
fn main() {
let a = [0];
2012-03-26 20:35:18 -05:00
let v: *mut [int] = ptr::mut_addr_of(a);
2012-03-26 20:35:18 -05:00
fn f(&&v: *mut [const int]) {
unsafe {
2012-03-26 20:35:18 -05:00
*v = [mut 3]
}
}
f(v);
}