17 lines
258 B
Rust
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);
|
|
}
|
|
}
|