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

Remove Allowed::replace and Allowed::take. #231

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

jrvanwhy
Copy link
Collaborator

@jrvanwhy jrvanwhy commented Aug 7, 2020

When I originally implemented Allowed, I made it work with non-Copy types. Allowed::get cannot with with non-Copy types, so I added Allowed::replace to allow client code to read a non-Copy type out of an Allowed buffer. However, during the PR review we changed Allowed to only contain Copy types. Because of this change, I don't anticipate Allowed::replace (and Allowed::take which is built on top of Allowed::replace) seeing much use. This PR removes Allowed::replace and Allowed::take to reduce the amount of unsafe in libtock_platform.

When I originally implemented Allowed, I made it work with non-Copy types. Allowed::get cannot with with non-Copy types, so I added Allowed::replace to allow client code to read a non-Copy type out of an Allowed buffer. However, during the PR review we changed Allowed to only contain Copy types. Because of this change, I don't anticipate Allowed::replace (and Allowed::take which is built on top of Allowed::replace) seeing much use. This PR removes Allowed::replace and Allowed::take to reduce the amount of `unsafe` in libtock_platferm.
Copy link
Contributor

@hudson-ayers hudson-ayers left a comment

Choose a reason for hiding this comment

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

This seems straightforward.

bors r+

bors bot added a commit that referenced this pull request Aug 7, 2020
231: Remove `Allowed::replace` and `Allowed::take`. r=hudson-ayers a=jrvanwhy

When I originally implemented `Allowed`, I made it work with non-`Copy` types. `Allowed::get` cannot with with non-`Copy` types, so I added `Allowed::replace` to allow client code to read a non-`Copy` type out of an `Allowed` buffer. However, during the PR review we changed `Allowed` to only contain `Copy` types. Because of this change, I don't anticipate `Allowed::replace` (and `Allowed::take` which is built on top of `Allowed::replace`) seeing much use. This PR removes `Allowed::replace` and `Allowed::take` to reduce the amount of `unsafe` in `libtock_platform`.

Co-authored-by: Johnathan Van Why <jrvanwhy@google.com>
@jrvanwhy
Copy link
Collaborator Author

jrvanwhy commented Aug 7, 2020

bors r-

@bors
Copy link
Contributor

bors bot commented Aug 7, 2020

Canceled.

@jrvanwhy jrvanwhy added the significant Indicates a PR is significant as defined by the code review policy. label Aug 7, 2020
@jrvanwhy
Copy link
Collaborator Author

jrvanwhy commented Aug 7, 2020

I think this is a significant PR as per the code review policy, and so should wait a week before merge.

@jrvanwhy
Copy link
Collaborator Author

I believe this PR is ready to merge.

@hudson-ayers
Copy link
Contributor

bors r+

bors bot added a commit that referenced this pull request Aug 18, 2020
231: Remove `Allowed::replace` and `Allowed::take`. r=hudson-ayers a=jrvanwhy

When I originally implemented `Allowed`, I made it work with non-`Copy` types. `Allowed::get` cannot with with non-`Copy` types, so I added `Allowed::replace` to allow client code to read a non-`Copy` type out of an `Allowed` buffer. However, during the PR review we changed `Allowed` to only contain `Copy` types. Because of this change, I don't anticipate `Allowed::replace` (and `Allowed::take` which is built on top of `Allowed::replace`) seeing much use. This PR removes `Allowed::replace` and `Allowed::take` to reduce the amount of `unsafe` in `libtock_platform`.

Co-authored-by: Johnathan Van Why <jrvanwhy@google.com>
@bors
Copy link
Contributor

bors bot commented Aug 19, 2020

Build failed:

@hudson-ayers
Copy link
Contributor

build failure will be fixed by #232

@jrvanwhy
Copy link
Collaborator Author

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 19, 2020

Build succeeded:

@bors bors bot merged commit d399b9d into tock:master Aug 19, 2020
@jrvanwhy jrvanwhy deleted the rm-allowed-replace branch November 11, 2020 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
significant Indicates a PR is significant as defined by the code review policy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants