take_mut crate uses
ptr::read to “move” from a
&mut T into another variable. But I’m not certain to what extent that impacts the original
&mut T no longer being considered to have the
T. I’m mostly thinking about what happens if
T is itself a
&mut. There would exist simultaneously a
&mut whatever and a read-from
&mut &mut whatever If usage matters, it’s possible the original was used before the
take call, and the copy used during it.
I don’t understand the rules around
&mut aliasing to have any idea if this is considered UB.