-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add loop contracts and harness for small_slice_eq
#122
base: main
Are you sure you want to change the base?
Add loop contracts and harness for small_slice_eq
#122
Conversation
The method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also please add a contract to this function since it is unsafe?
365d85c
to
d3ef481
Compare
Move `any_slice_from_array` to `kani_core` so that we can call them in verify-rust-std (an example harness in model-checking/verify-rust-std#122). By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
@@ -230,6 +230,7 @@ | |||
#![feature(unboxed_closures)] | |||
#![feature(unsized_fn_params)] | |||
#![feature(with_negative_coherence)] | |||
#![feature(proc_macro_hygiene)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this? I would prefer not enabling any new feature in the standard library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required to use macro for loops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error I got without the feature suggests to include it.
error[E0658]: custom attributes cannot be applied to expressions
--> simple_while_loop_not_enabled.rs:15:5
|
15 | #[kani::loop_invariant(x >= 2)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #54727 <https://github.com/rust-lang/rust/issues/54727> for more information
= help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable
= note: this compiler was built on 2024-11-02; consider upgrading it if it is out of date
Porting from https://github.com/model-checking/kani/blob/main/tests/expected/loop-contract/small_slice_eq.rs
The cbmc argument
--object-bits 8
is needed to avoid running out of memory for the harness.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.