dtolnay / ghost

Define your own PhantomData

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid unimplementing auto traits on phantom struct

alecmocatta opened this issue · comments

This line:

Variance::Covariant => base,
could be relaxed to quote!(fn() -> #phantom) to avoid unimplementing auto traits on the phantom struct and also affecting the drop check.

Phantom structs should probably always be Send, Sync and so on, I would have thought? But right now they only are if all covariant arguments also are.

I think the current implementation is behaving correctly. The autotrait impls for core::marker::PhantomData are also conditional.
https://doc.rust-lang.org/1.60.0/std/marker/struct.PhantomData.html#impl-Send


Screenshot from 2022-04-24 16-12-09