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

Failed to stub_verified contracts with slices in kani::modifies #3682

Open
qinheping opened this issue Nov 5, 2024 · 0 comments
Open

Failed to stub_verified contracts with slices in kani::modifies #3682

qinheping opened this issue Nov 5, 2024 · 0 comments
Labels
[C] Bug This is a bug. Something isn't working.

Comments

@qinheping
Copy link
Contributor

I tried this code:

#[kani::modifies(x)]
#[kani::requires(x.len() > 5)]
fn modify_slice(x: &mut [u8]) {
    let mut i = 3;
    while i > 0{
        x[i] = 1;
        i -= 1;
    }
}

#[kani::proof]
#[kani::stub_verified(modify_slice)]
fn test_stubbing() {
    let mut x = [kani::any(), kani::any(), kani::any(), kani::any(), kani::any(), kani::any()];
    modify_slice( &mut x);
}

using the following command line invocation:

kani -Zfunction-contracts test_stubbing.rs

with Kani version: 0.56.0

I expected to see this happen: Verification success.

Instead, this happened:

thread 'rustc' panicked at kani-compiler/src/kani_middle/reachability.rs:446:69:
called `Result::unwrap()` on an `Err` value: Error("Failed to resolve `FnDef(DefId { id: 46, name: \"std::iter::IntoIterator::into_iter\" })` with `GenericArgs([Type(Ty { id: 106, kind: RigidTy(Ref(Region { kind: ReErased }, Ty { id: 115, kind: RigidTy(Slice(Ty { id: 21, kind: RigidTy(Slice(Ty { id: 2, kind: RigidTy(Uint(U8)) })) })) }, Mut)) })])`")
@qinheping qinheping added the [C] Bug This is a bug. Something isn't working. label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working.
Projects
None yet
Development

No branches or pull requests

1 participant