Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,17 @@ fn main(mut x: Field) {
add2(&mut x);
assert(x == 3);

issue_2120();
}

// https://github.com/noir-lang/noir/issues/2120
fn issue_2120() {
let x1 = &mut 42;
let set_x1 = |y| { *x1 = y; };

assert(*x1 == 42);
set_x1(44);
assert(*x1 == 44);
set_x1(*x1);
assert(*x1 == 44);
}
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/monomorphization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ impl<'interner> Monomorphizer<'interner> {
});

let location = None; // TODO: This should match the location of the lambda expression
let mutable = false;
let mutable = true;
let definition = Definition::Local(env_local_id);

let env_ident = ast::Ident {
Expand Down