`Phantom` "Trait"

An alternative formulation that might be more (or less) acceptable this made me think of is "anonymous fields":

struct Foo<T> {
  id: u32,
  _: PhantomData<T>,
}

let foo: Foo<String> { id: 123 }

The difference is there's less magic in the field type, but it would still need something, but perhaps just a Default bound, which might be useful outside of PhantomData?

4 Likes