-
Notifications
You must be signed in to change notification settings - Fork 97
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
Improvements needed for the 'kani' library #1394
Comments
I tried adding |
Generally agreed. I think we will have to move to this direction anyway due to certain protests using this. Although, one concern is that |
As discussed offline, regarding the first topic, we will do the following:
|
any
,Arbitrary
andInvariant
Invariant
is basically inviting undefined behavior. For instance, an invariant like "this enum must match one of its variants" is something the rust compiler could replace with justtrue
. (It sort of already does: if you do this with pattern matching, it recognizes the wildcard branch as dead code, and Kani helpfully codegen's dead code asassert(false)
!)Arbitrary
offers essentially nothing useful. For instance, implementingArbitrary
forMyType
does not mean you can useany()
forOption<MyType>
because the implication instances forOption
are onInvariant
Invariant
toArbitrary
but that starts to eliminate the usefulness ofInvariant
, and... (next item)Invariant
, it's just that we'd want the compiler to synthesize the basic ones for types. (All the invariants that are undefined behavior are the ones we should be able to implement automatically because they're the Rust invariants for types.)any_raw
private, users probably shouldn't be using it, and it's mostly UB. It can be mimic'd by gettingany
bytes and thentransmute
, with all the obvious UB implications.any_vec, slices
I don't believe the current API is the one we should consider stabilized.
any_slice
returns a fairly complicatedAnySlice
type, because it needs something to own the data. Thing is, the standard library already has a type for that...Vec
. I'm not sure why we don't just haveany_vec
alone here.raw
functions as private.any_slice_of_array
should beany_subslice
any_slice
andany_vec
pass in the bound as a const generic. Seems like it'd be best if it were an ordinary parameter. It makes these hard to use. (I didn't look into the implementations though, so could easily be a reason we have to unfortunately)kani::any_vec
notkani::vec::any_vec
any_string
implementation.Assertions
nondet
should be removed or at leastdoc(hidden)
panic
should probably be at leastdoc(hidden)
. Not something we expect customers to know about.assert
should be renamedcheck
expect_fail
should be replaced withcover
Renameexpect_fail
toshould_fail
or other phrases. #1197The text was updated successfully, but these errors were encountered: