Excellent explanation, thanks. Rust’s move semantics around “all types must survive a memcpy” are (IMO) a great idea 99.9% of the time (no move constructors, no worrying about “pillaging” the source of a move to make its destructor safe to run, you can express more invariants since you don’t need to be able to express such pillaging) but it’s one of the places where something that is “simple” in C++ is truly hard to accomplish in Rust.
Rust has added Pin later on in the language to express data that can’t be moved, but IME I only see it used in desugared async code to guarantee that values stay put between awaits, and it’s not common to see Pin used for general code. I don't think you can just sprinkle some Pin<T> into existing code and solve the object identity problem, although I've never really had to deal with code that's move-sensitive so I don't know.
Rust has added Pin later on in the language to express data that can’t be moved, but IME I only see it used in desugared async code to guarantee that values stay put between awaits, and it’s not common to see Pin used for general code. I don't think you can just sprinkle some Pin<T> into existing code and solve the object identity problem, although I've never really had to deal with code that's move-sensitive so I don't know.