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

Add non-fatal failure check to rmc prelude #695

Closed
celinval opened this issue Dec 14, 2021 · 6 comments
Closed

Add non-fatal failure check to rmc prelude #695

celinval opened this issue Dec 14, 2021 · 6 comments
Assignees
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.

Comments

@celinval
Copy link
Contributor

Requested feature: Provide a mechanism for users to add property check to their code that do not abort the program when a failure occurs.
Use case: This can be extremely helpful for adding more information to potential fatal failures without affecting the code path. This can also help while writing tests for RMC.
Link to relevant documentation (Rust reference, Nomicon, RFC):
Is this a breaking change? None

Test case:

/// Dummy verification harness that ensures that method shuffle generates a new array that has all the
/// elements from the source array.
#[rmc::proof]
fn check_shuffle() {
    let a1: [u8; 5] = rmc::nondet();
    let a2 = shuffle(&a1);
    rmc::check(a2.size() == a1.size());
    for x in &a1 {
        rmc::check(a2.contains(x));
    }
}

In this harness, it might be helpful to understand if 1 or more items are missing from the array. With rmc::check() we can easily verify all the elements and find as many failures as possible. If we replace rmc::check by assert the analysis would stop in the first failure.

@celinval celinval self-assigned this Dec 14, 2021
@celinval
Copy link
Contributor Author

Note to self: Revert the hack made to the existing testcases here: #687

@celinval celinval added [C] Feature / Enhancement A new feature request or enhancement to an existing feature. and removed Type: prelude labels Nov 9, 2022
@adpaco-aws
Copy link
Contributor

Found this issue while looking for "shuffle"... Is this something we still want?

@celinval
Copy link
Contributor Author

I'm OK closing this.

@tedinski
Copy link
Contributor

I still want kani::check, re-opening unless I get overruled :)

I think it'd at least be good for ourselves writing tests, and possibly as extra documentation making it clear that assert aborts execution.

@carolynzech
Copy link
Contributor

@celinval should we close this as "won't do? given #3561?

@celinval
Copy link
Contributor Author

Closing this one since we haven't found any use case for it.

@celinval celinval closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.
Projects
None yet
Development

No branches or pull requests

4 participants