Despite reading the "original thread", I actually have no idea what the motivation/argument in favor of this change is supposed to be. It feels like there's a lot of context missing.
Do we know why this magic exists today? Is it to prevent double-drop? If so, I don't see how this change affects the need for it.
But... it's just a lint. It can't actually guarantee no double-drops occur via sufficiently convoluted recursion (because that requires solving the halting problem), which means this is fundamentally unsound... right?
More generally, I don't get how this is an improvement over using Option
or ManuallyDrop
on the field you want to move out of on drop() (and possibly wrapping that in some macro magic like @literda's doing). Both require understanding this issue enough to opt-in to the non-default behavior, the opt-in is not hard, and in the case of ManuallyDrop
it's zero-overhead. To the extent that I even understand what's being proposed (which I'm not at all sure I do), this sounds like it's just a different way to make the compiler generate the same code you'd get by using one of those wrappers today.