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

Implement kani::Arbitrary for Box<T> #2404

Merged
merged 5 commits into from
Apr 25, 2023

Conversation

adpaco-aws
Copy link
Contributor

Description of changes:

This PR implements Arbitrary for Box<T>. This is required for structs that #[derive(kani::Arbitrary)] and have members with Box<T> types.

Resolved issues:

Resolves #2403

Call-outs:

  • I haven't thought too much about the best way to test these changes, so I'm open to suggestions.
  • The same-purpose tests added in Implement Arbitrary for PhantomData and PhantomPinned #2225 were in the ui folder. I moved them to expected because that seems to be a better place (no UI testing is done in those tests).

Testing:

  • How is this change tested? Existing tests + new one.

  • Is this a refactor change? No.

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@adpaco-aws adpaco-aws requested a review from a team as a code owner April 24, 2023 20:47
@adpaco-aws adpaco-aws enabled auto-merge (squash) April 24, 2023 21:46
Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

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

I'm concerned about the soundness of the Arbitrary implementation. We need to make sure the implementation covers all possible states a box can be in. I'm a bit unclear on whether this is the case with the current implementation.

library/kani/src/arbitrary.rs Show resolved Hide resolved
tests/expected/derive-arbitrary/box/test.rs Outdated Show resolved Hide resolved
@adpaco-aws adpaco-aws merged commit b10ef23 into model-checking:main Apr 25, 2023
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.

Feature request: Implement kani::Arbitrary for Box<T>
3 participants