I\'m trying to update some older code I wrote that basically looks like:
trait Foo{}
struct Bar>{
b: B
}
Depending on how your real Foo is, you might be able to work with associated types instead, like this:
trait Foo{ type T; }
struct Bar {
b: B,
}
otherwise (if you do need to have the type parameter on Foo), PhantomData is indeed the way to go.
You were not the only person finding PhantomData's docs confusing (see PhantomData is incomprehensible). As a result, the documentation for PhantomData has been recently improved by Steve Klabnik and now it does mention this scenario explicitly (and not just unsafe code).