rust/tests/ui/suggestions/dont_suggest_raw_pointer_syntax-issue-127562.rs

8 lines
177 B
Rust

fn main() {
let val = 2;
let ptr = std::ptr::addr_of!(val);
unsafe {
*ptr = 3; //~ ERROR cannot assign to `*ptr`, which is behind a `*const` pointer
}
}