Not if you made the Result
structually pinned (as you have in the OP), is how I understand it.
Let's say Bar
contained a Result<T, E>
. You've provided a safe method to get from Pin<&mut Bar>
to Pin<&mut Result<T, E>>
. It's up to Result<T, E>
to decide if there's a safe way to get from there to Pin<&mut T>
... or to &mut T
. If they decide on the latter, and you also provided the safe projection from Pin<&mut Bar>
to Pin<&mut T>
, one could (without unsafe
) create the Pin<&mut T>
, then the Pin<&mut Result<T, E>>
, then the &mut T
, and then swap out the T
without calling drop.
What if you hadn't provided a way to get a Pin<&mut Result<T, E>>
? Then, as I understand it, you could provide the Pin<&mut T>
projection (provided you meet all the other requirements).