Skip to content
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

Merged
merged 12 commits into from
Oct 8, 2021

Conversation

Manishearth
Copy link
Member

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.

Copy link
Member

@nordzilla nordzilla left a 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.

@Manishearth Manishearth merged commit f033297 into unicode-org:main Oct 8, 2021
@Manishearth Manishearth deleted the yoke-generics branch October 8, 2021 17:51
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-commit LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants