Post

Continuing on my crackpot theories of contravariant lifetimes, here's an interesting alternative formulation of Rust Pin: a pinned type holds a reference to itself (potentially inside a PhantomData). Moving the item invalidates that reference, so it invalidates the type.

It's possible to use this to write a Pinnable type today that wraps a T and only exposes Pin references to that T, but it's not sound because Pin requires that Drop is always called but Pinnable can be put into a ManuallyDrop to inhibit that.

0 reposts1 like

No replies yet.