Skip to content

Parse &mut + ensures as &strg #1088

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Parse &mut + ensures as &strg #1088

wants to merge 2 commits into from

Conversation

ranjitjhala
Copy link
Contributor

@ranjitjhala ranjitjhala commented Apr 26, 2025

This implements Niko Matsakis' suggestion to let us just write the update clause with an ensures instead of necessarily having to spell out &strg e.g. the below works (and you get an error if the relevant location is not a &mut.

#[flux::sig(fn (x: &mut i32[@n]) ensures x: i32[n+1])]
pub fn incr(x: &mut i32) {
    *x += 1;
}

#[flux::sig(fn () -> i32[11])]
pub fn client_safe() -> i32 {
    let mut p = 10;
    incr(&mut p);
    p
}

@ranjitjhala ranjitjhala marked this pull request as ready for review April 28, 2025 18:53
@ranjitjhala
Copy link
Contributor Author

ping @nilehmann

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

Successfully merging this pull request may close these issues.

2 participants