Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[derive] Support deriving on unsized types #122

Merged
merged 1 commit into from
Nov 8, 2022
Merged

[derive] Support deriving on unsized types #122

merged 1 commit into from
Nov 8, 2022

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Nov 3, 2022

In order to test this support, add a new Unsized type in zerocopy's
test module. Use this to test the derive and also to test AsBytes's
methods in test_as_bytes_methods. These tests supersede the previous
unsized tests, which used slices, and have been removed.

While we're here, expand test_as_bytes_methods to test the write_to,
write_to_prefix, and write_to_suffix methods, which were not
previously tested.

@joshlf joshlf force-pushed the derive-unsized branch 2 times, most recently from 3a8ed95 to e1d80f6 Compare November 6, 2022 01:01
@joshlf
Copy link
Member Author

joshlf commented Nov 6, 2022

@djkoloski mind taking a look at this? It depends on #120, so I'll wait for that to merge before submitting this.

@joshlf joshlf force-pushed the derive-unsized branch 2 times, most recently from 14aaeaa to 4f80bce Compare November 6, 2022 18:24
djkoloski
djkoloski previously approved these changes Nov 7, 2022
@joshlf
Copy link
Member Author

joshlf commented Nov 8, 2022

Hey @djkoloski , thanks for the review! After your review, I made a few substantive changes (mostly to tests). Can you take a look and let me know if everything still looks good to you? Here's the diff compared to what you reviewed.

djkoloski
djkoloski previously approved these changes Nov 8, 2022
In order to test this support, add a new `Unsized` type in zerocopy's
`test` module. Use this to test the derive and also to test `AsBytes`'s
methods in `test_as_bytes_methods`. These tests supersede the previous
unsized tests, which used slices, and have been removed.

While we're here, expand `test_as_bytes_methods` to test the `write_to`,
`write_to_prefix`, and `write_to_suffix` methods, which were not
previously tested.

Also in order to test this support, implement zerocopy traits for
`PhantomData` and `ManuallyDrop` for unsized types.

While we're here, add a new `test_impls` test to ensure that all
expected zerocopy trait impls are emitted.
@joshlf joshlf merged commit 342260b into main Nov 8, 2022
@joshlf joshlf deleted the derive-unsized branch November 8, 2022 04:23
joshlf added a commit that referenced this pull request Aug 3, 2023
In order to test this support, add a new `Unsized` type in zerocopy's
`test` module. Use this to test the derive and also to test `AsBytes`'s
methods in `test_as_bytes_methods`. These tests supersede the previous
unsized tests, which used slices, and have been removed.

While we're here, expand `test_as_bytes_methods` to test the `write_to`,
`write_to_prefix`, and `write_to_suffix` methods, which were not
previously tested.

Also in order to test this support, implement zerocopy traits for
`PhantomData` and `ManuallyDrop` for unsized types.

While we're here, add a new `test_impls` test to ensure that all
expected zerocopy trait impls are emitted.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants