Re: [PATCH] rust: arc: remove unused PhantomData

From: Miguel Ojeda
Date: Tue Nov 05 2024 - 07:29:43 EST


On Mon, Nov 4, 2024 at 11:42 PM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
>
> I believe we need this `PhantomData` to inform drop chec [1] that the
> drop of `Arc` may result into the drop of an `ArcInner<T>`. Rust std
> `Arc` has the similar definition [2], you can find more information
> about PhantomData usage on drop checking at [3].

Hmm... But they use `may_dangle` in their `Drop` and we don't (and we
have a `Drop` unlike something like `Unique`), no? Or am I confused?
i.e. if I understand correctly, that would have been needed in the
past, but not anymore.

In any case, a comment here clarifying would be good -- the standard
library does that in some of its types, which is a good idea. At the
very least, the name of the field should indicate why we have the
marker. I will add that to the guidelines patch I have to send...

Thanks!

Cheers,
Miguel