In the docs about Pin especially Drop guarantee section it is said that data pointed by Pin should not be invalidated, repurposed etc, including calling
Though it is completely possible to do so from
mut Pin<Option<T>> as well as do mem::swap for mutable Pin pointers:
let mut opt: Option<Vec<u32>> = Some((1..=10).collect()); let mut pin_opt = Pin::new(&mut opt); let _ = pin_opt.take(); dbg!(pin_opt);
So mutable Pin pointers are used widely in async world, though as I got they do not provide Pin guarantees so that objects cannot move. Is the only point of mutable Pin is to use them as a kind of a factory for immutable Pins while when no immutable Pin issued object can move in memory?
More examples of when memory can move with mut Pin: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9b42eecd3094c383393ef8bda17729d8