`Pin<&T>` concerns

I believe the difference is that the "pinning projections" link shows how an imaginary method on RefCell that could lead to UB by creating mutable aliases, but it doesn't address the issue of holding a Pin<&Field> and then moving Field as @alice described. And that is possible through RefCell::replace among others. Quoting OP:

Pin::map_unchecked does allow exactly this (AFAIK). See: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8e534b883bae91be268ce7d643f822a6

1 Like