prusti-dev icon indicating copy to clipboard operation
prusti-dev copied to clipboard

Shallow Borrows not supported

Open Patrick-6 opened this issue 2 years ago • 0 comments

Shallow borrows are not yet supported by Prusti. These appear when verifying code containing match guards on references:

use prusti_contracts::*;

struct Wrapper { x: i32 }

fn test(t: &Wrapper) {
    match t {
        Wrapper{ x } if x % 2 == 0 => {},
        Wrapper{ x } => {}
    }
}

Error:

[Prusti: unsupported feature]
unsupported creation of shallow borrows (implicitly created when lowering matches)

This limitation is also mentioned in #543 in the test tests_old/verify/fail/simple-specs/order-of-branches.rs.

Patrick-6 avatar Apr 05 '23 09:04 Patrick-6