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

custom attribute panicked on predicate using an if let construct #909

Open
adpaco-aws opened this issue Nov 13, 2023 · 1 comment
Open
Labels
bug Something isn't working error-messages Improve error messages pearlite Improve pearlite

Comments

@adpaco-aws
Copy link

I was trying to work around error[creusot]: called Program function in Logic context "std::result::Result::<T, E>::is_ok" by defining a predicate like:

    #[creusot_contracts::predicate]
    pub fn typechecks(e: &Expr) -> bool {
        if let Ok(_) = Self::typecheck(e) {
            true
        } else {
            false
        }
    }

which triggered this error:

error: custom attribute panicked
   --> src/lib.rs:124:5
    |
124 |     #[creusot_contracts::predicate]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: Unsupported(#0 bytes(3107..3137), "Let")

Please note that I don't expect this to work since we're still using a "program function in logic context". But a better error message would be much appreciated.

@xldenis
Copy link
Collaborator

xldenis commented Nov 13, 2023

I think the problem here is actually the if let, which isn't handled in pearlite

@xldenis xldenis added bug Something isn't working error-messages Improve error messages pearlite Improve pearlite labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working error-messages Improve error messages pearlite Improve pearlite
Projects
None yet
Development

No branches or pull requests

2 participants