Closed
Description
To work around the parameter
T is never used [E0392]
error, one if often suggested to use PhantomData.
However, the documentation of PhantomData explains that various forms are possible, but is quite vague about the consequences of the choice of a form (and also only handles a small subset of the possible forms).
From my understanding given this reddit thread I opened these various forms can have different consequences (regarding dopck and/or lifetime variance ?):
PhantomData<T>
PhantomData<&'a T>
PhantomData<&'a mut T>
PhantomData<*const T>
PhantomData<*mut T>
PhantomData<fn(T) -> ()>
PhantomData<fn() -> T>
PhantomData<fn(T) -> T>
But I have no real idea about what using one or another changes.
Metadata
Metadata
Assignees
Labels
No labels