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

Add get_mut methods to collection types #6754

Open
TomAFrench opened this issue Dec 10, 2024 · 1 comment
Open

Add get_mut methods to collection types #6754

TomAFrench opened this issue Dec 10, 2024 · 1 comment

Comments

@TomAFrench
Copy link
Member

TomAFrench commented Dec 10, 2024

I noticed in AztecProtocol/aztec-packages#10556 that when wanting to mutate a nested value in a BoundedVec it's necessary to use a pattern like the below:

let mut nullifier = builder.previous_kernel.nullifiers.get(2);
nullifier.nullifier.note_hash = 9988;
builder.previous_kernel.nullifiers.set(2, nullifier);

Ideally we'd support mutating the returned element to allow something like the below by returning a mutable reference to the element.

builder.previous_kernel.nullifiers.get_mut(2).nullifier.note_hash = 9988;
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Dec 10, 2024
@jfecher
Copy link
Contributor

jfecher commented Dec 10, 2024

This'd require some large SSA changes since we don't support getting a mutable reference to an array element at all currently. Only ArrayGet which conceptually returns a copy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants