-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for generics in derive(Yokeable, ZeroCopyFrom) #1162
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all look good to me. I read through every line and what you're doing makes sense overall. I also appreciate the occasional comments that further explain what is going on. Thanks for adding tests for all of it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-commit LGTM
This requires that all generics are
'static
for the traits to work. It is theoretically possible to generate impls for non-'static
generics, but at that point the bounds get really complicated and I don't see much of a use case for this kind of thing.There's some tricky code involved in generating the bounds. This code isn't safety-crucial, however the
'static
bounds are.Fortunately, the safety invariants are usually handled by
Yokeable::transform()
proving covariance automatically, so we don't need to do much additional work except when proving covariance manually.