Open TimDiekmann opened 5 years ago
It feels like the right thing to do would be to file an issue against rust to allow any type rather than ZSTs only. ZSTs was the easy way out, that doesn't require much thought, but eventually, non-ZSTs should be supported.
There was an discussion on Zulip recently on this topic.
ZSTs was the easy way out, that doesn't require much thought, but eventually, non-ZSTs should be supported.
Are there any downsides of supporting non-ZSTs?
While ZST fields are now supported in
DispatchFromDyn
, it still cannot be used in a generic context as typeck does not know anything about the parameter. I.e. this is not allowed asA
is unknown:This does not block the implementation for
Box<T, A>
, as we only needDispatchFromDyn<Box<U, Global>> for Box<T, Global>
to maintain semver compatibility.How can this be solved?
One way I can think of is a trait similar to the
Unsize
trait:which is implemented for all ZSTs. typeck could then check for this trait to be implemented and the above code becomes