I have an alternative solution
With this we don't use a marker trait, instead we have a special annotation, so we can write our own marker object (line PhantomPinned
).
struct PhantomNoDrop;
impl Drop for PhantomNoDrop {
#[do_not_call]
fn drop(&mut self) { unreachable!() }
}
With this any type that in its generated drop clue cannot call this drop
implementation otherwise the compiler will complain.