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

Closure can't mutate captured variable #7129

Closed
asterite opened this issue Jan 21, 2025 · 1 comment
Closed

Closure can't mutate captured variable #7129

asterite opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@asterite
Copy link
Collaborator

Aim

This code:

fn main() {
    let mut array = [1, 2, 3];
    callback(|i| { array[i] = 0; });
    println(array);
}

fn callback<Env>(f: fn[Env](u32) -> ()) {
    f(1);
}

Expected Behavior

Expected it to print [1, 0, 3].

Bug

It prints [1, 2, 3].

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@asterite asterite added the bug Something isn't working label Jan 21, 2025
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 21, 2025
@TomAFrench
Copy link
Member

#7127 (comment)

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants