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

Postcondition failure on a match is reported with a misleading span #281

Closed
1 task
utaal opened this issue Sep 5, 2022 · 1 comment
Closed
1 task

Comments

@utaal
Copy link
Collaborator

utaal commented Sep 5, 2022

#[is_variant]
enum Enum {
    A,
    B,
}


fn test(a: u32) -> (res: Enum)
    ensures (match res {
        Enum::A => a <= 10,
        Enum::B => a > 10, // FAILS
    }) {

    Enum::B
}

results in this error message, which points to the wrong branch of the match, while it should just point to the entire match, I think:

error: postcondition not satisfied
  --> test.rs:24:8
   |
22 |           Enum::A => a <= 10,
   |           ------- failed this postcondition
23 |           Enum::B => a > 10, // FAILS
24 |       }) {
   |  ________^
25 | |
26 | |     Enum::B
27 | | }
   | |_^ at the end of the function body

Originally found by @matthias-brun.


@utaal utaal added the bug label Sep 5, 2022
utaal added a commit that referenced this issue Sep 5, 2022
@utaal
Copy link
Collaborator Author

utaal commented Mar 1, 2023

Moved to #387

@utaal utaal closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant