This question looks like it's better suited for https://users.rust-lang.org/ (which is for general help using Rust). This forum is focused on developing Rust itself (both the language and the core tools like the compiler).
The reason for this error is that generic types have a variance in each of their parameters, which is inferred from how each parameter is used in the type's definition: https://doc.rust-lang.org/nomicon/subtyping.html
Variance matters because it determines how MyStruct<T> and MyStruct<U> are related, via subtyping. For example, if you have two lifetimes 'a and 'b where 'a outlives 'b, then you may want to be able to pass a MyStruct<&'a i32> where a MyStruct<&'b i32> is expected.
This is fine if MyStruct<T> uses T directly, as in field: T. But if MyStruct<T> instead contains a field: fn(T), this relationship must be reversed, and you would instead want to pass a MyStruct<&'b i32> where a MyStruct<&'a i32> is expected.
Because variance is inferred from how parameters are used, for a use to "count" it must force a particular kind of variance. PhantomData pretends, for the purpose of inferring variance, to be its parameter- which is how you specify variance for parameters that aren't otherwise used in that way.