*const
to *mut
RS-S1011Converting *const
to *mut
works in safe code. However, mutating such a pointer can result in
undefined behavior. Such situations can only occur in unsafe code, because dereferencing pointers is an
unsafe operation.
let x = 10;
let foo = &x as *const i32 as *mut i32;