derive kani::Arbitrary on f16 and bf16 #80
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, thanks for the great library 馃榿
I've been using kani to introduce some lightweight formal methods for a CBOR implementation I'm working on.
Kani has a trait
Arbitrary
which is used to generate symbolic values in the model checker (conceptually, a value that represents "for allT
s").The rough motivation for this PR is an enum that looks like:
This currently fails, since
half::f16
doesn't implementkani::Arbitrary
. This PR adds the derive macros, gated behind thekani
compiler option being set. This doesn't add a cargo feature flag or optional dependency, since kani doesn't require this (when you verify a program, it compiles it with its own standard library, which injects thekani
dependency).I appreciate you may not want this sort of tool in the codebase, since it's fairly non-standard Rust, and could be unexpected/confusing for contributors, but FWIW, I've had very positive experiences with it. Happy to be given pushback on this though 馃槄 .
Usually I'd open an issue for this sort of thing first, but since the PR is so trivial, I thought it might just be easier this way.
Thanks 馃榿