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(aztec-nr): Use mutable ref when mutating variable in closure #12311

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions noir-projects/aztec-nr/aztec/src/macros/dispatch/mod.nr
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ pub comptime fn generate_public_dispatch(m: Module) -> Quoted {
}
};

let mut parameter_index = 0;
let parameter_index = &mut 0;
let reads = parameters.map(|param: (Quoted, Type)| {
let param_name = f"arg{parameter_index}".quoted_contents();
let parameter_index_value = *parameter_index;
let param_name = f"arg{parameter_index_value}".quoted_contents();
let param_type = param.1;
let read = quote {
let $param_name: $param_type = reader.read_struct(dep::aztec::protocol_types::traits::Deserialize::deserialize);
};
parameter_index += 1;
*parameter_index += 1;
quote { $read }
});
let read = reads.join(quote { });
Expand Down
2 changes: 1 addition & 1 deletion noir-projects/precommit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ if [[ -n "$staged_nr_files" ]]; then
echo "$staged_nr_files" | xargs -I {} git add "$repo_root/{}"
fi

# We just don't say anything if there are no staged nr files, because no one cares.
# We just don't say anything if there are no staged nr files, because no one cares.
Loading