What's the different between PhantomData<Box<Node<T>>> and PhantomData<T>

Rust LinkedList has following definition:

pub struct LinkedList {
head: Option<NonNull<Node>>,
tail: Option<NonNull<Node>>,
len: usize,
marker: PhantomData<Box<Node>>,
}

struct Node {
next: Option<NonNull<Node>>,
prev: Option<NonNull<Node>>,
element: T,
}

PhantomData is major for two purpose: variance & dropchk.

I already read 0769-sound-generic-drop and 1238-nonparametric-dropck but did not fully understand it.

What's the differece between PhantomData<Box<Node<T>>> , PhantomData<Node<T>> and PhantomData<T> ?

I also posted the same topic on stackoverflow: rust - What's the different between PhantomData<Box<Node<T>>> and PhantomData<T> - Stack Overflow.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.