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

Fix ensures for unit-returning functions with &mut inputs #847

Merged
merged 2 commits into from
Aug 13, 2024
Merged

Conversation

W95Psp
Copy link
Collaborator

@W95Psp W95Psp commented Aug 13, 2024

Fixes #844, and #845

Fixes this kind of code:

#[hax_lib::ensures(|_| true)]
fn issue_844(_x: &mut u8) {}

// From issue #845
mod ensures_on_arity_zero_fns {
    #[hax_lib::requires(true)]
    #[hax_lib::ensures(|_x| true)]
    fn doing_nothing() {}
    #[hax_lib::requires(true)]
    #[hax_lib::ensures(|x| x > 100)]
    fn basically_a_constant() -> u8 {
        127
    }
}

Open this code snippet in the playground

@W95Psp W95Psp changed the title Fix 844 Fix requires for unit-returning functions with &mut inputs Aug 13, 2024
@W95Psp W95Psp changed the base branch from main to fix-fsti-fst-options August 13, 2024 14:42
@W95Psp W95Psp changed the title Fix requires for unit-returning functions with &mut inputs Fix ensures for unit-returning functions with &mut inputs Aug 13, 2024
Copy link
Contributor

@karthikbhargavan karthikbhargavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and it resolves my two issues. Thanks!

@W95Psp
Copy link
Collaborator Author

W95Psp commented Aug 13, 2024

Thanks will put it in merge queue when the over is done

Base automatically changed from fix-fsti-fst-options to main August 13, 2024 15:40
@W95Psp W95Psp added this pull request to the merge queue Aug 13, 2024
Merged via the queue into main with commit bea9074 Aug 13, 2024
13 checks passed
@W95Psp W95Psp deleted the fix-844 branch August 13, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Bad translation of ensures with &mut
2 participants