Hi, I'm trying to understand the usage of PhantomData to tell dropck that we "own T" I easily see the usage for PhantomData in lifetimes, but not here I read the comment above this: https://github.com/rust-lang/rust/blob/master/src/libcore/ptr/unique.rs#L45, the link, the nomicon sections about dropchk+PhantomData
and still don't get it.
Any explanations/examples are welcome :)
I believe it's because the dropcheck goes "outside in", if i'm reading the RFC linked to by that comment correctly.
EDIT: I misunderstood the question.
No, it would still compile. That use of
PhantomData is purely for dropck, as the comment indicates.
// NOTE: this marker has no consequences for variance, but is necessary // for dropck to understand that we logically own a `T`.
invalidate my claims (i.e. the "no consequence for variance" part).
I read https://doc.rust-lang.org/nomicon/dropck.html a few times. I understand the importance of Generic arguments strictly out living a type. what I don't understand now is -- how does this related to the
Unique<T> example above?