summary refs log tree commit diff
path: root/src/test/compile-fail/mutable-huh-ptr-assign.rs
blob: 8d6b95653330226e671101c18b1678002e92f491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// error-pattern: assigning to immutable box

use std;

fn main() {
    unsafe fn f(&&v: *const int) {
        // This shouldn't be possible
        *v = 1
    }

    unsafe {
        let a = 0;
        let v = ptr::mut_addr_of(a);
        f(v);
    }
}