Skip to content

snap function can be used in normal code #1298

@Patrick-6

Description

@Patrick-6

Using the snap function in normal code does not always cause a compiler error like in the first function. The second function causes Prusti to crash:

use prusti_contracts::*;

// This function does not cause a verification failure:
fn _test_should_fail(v: &u64) -> u64 {
    let s = snap(v); 
    let x = s + 1;
    x
}

// This function causes an internal error:
fn _test_internal_error(v: &u64) {
    let s = snap(v);
    prusti_assert!(&s === v);
}
thread 'rustc' panicked at 'internal error: entered unreachable code', prusti-viper\src\encoder\foldunfold\requirements.rs:449:38

The panicking code is here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions