The Rust Reference seems to say that mutating an immutable local data (that\'s not inside an UnsafeCell) is undefined behavior: Behavior considere
UnsafeCell