The Rust standard library provides the Pin<Ptr> struct to prevent the value referenced by the Ptr
from being moved. This is useful when dealing with data types which refer to themselves. The compiler may otherwise move data in memory when a semantic move is indicated.
The std::pin documentation provides the following example of a semantic move:
// -snip-
// Create a tracker and store the initial address
let mut tracker = AddrTracker::default();
tracker.check_for_move();
// Here we shadow the variable. This carries a semantic move, and may therefore also
// come with a mechanical memory *move*
let mut tracker = tracker;
// -snip-
This then begs the question, why move data to a new location in the first place? If the compiler never moved data, it would seem like we would not need to have this contract.