Skip to content

Some(&x) gives an unexpected internal error #1191

Open
@Stef-Gijsberts

Description

@Stef-Gijsberts

Minimal example:

pub fn main() {
    let a = 3;
    let b = Some(&a);
}

The error:

error: [Prusti internal error] Prusti encountered an unexpected internal error
 --> e25-wrapping-borrow.rs:1:1
  |
1 | / pub fn main() {
2 | |     let a = 3;
3 | |     let b = Some(&a);
4 | | }
  | |_^
  |
  = note: We would appreciate a bug report: https://github.com/viperproject/prusti-dev/issues/new
  = note: Details: cannot generate fold-unfold Viper statements. The required permission Acc(_3.val_ref.val_int, read) cannot be obtained.

In fact, any form of instantiating a struct with a reference field seems to fail. Another example which gives an error:

struct RefInt<'a>(&'a i32);

pub fn main() {
    let a = 3;
    let b = RefInt(&a);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existserror-reportingSomething needs to be fixed in the error reportingrefs-in-structsPrusti currently doesn't support references inside ADTs (structs, enums)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions