Skip to content

Commit

Permalink
fix: Minimal change to avoid reverting entire PR #6685 (#6778)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher authored Dec 12, 2024
1 parent 1b0dd41 commit 0925a33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,9 @@ impl<'a> FunctionContext<'a> {
// Don't mutate the reference count if we're assigning an array literal to a Let:
// `let mut foo = [1, 2, 3];`
// we consider the array to be moved, so we should have an initial rc of just 1.
let should_inc_rc = !let_expr.expression.is_array_or_slice_literal();
//
// TODO: this exception breaks #6763
let should_inc_rc = true; // !let_expr.expression.is_array_or_slice_literal();

values = values.map(|value| {
let value = value.eval(self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::mem::array_refcount;

fn main() {
let mut array = [0, 1, 2];
assert_refcount(array, 1);
assert_refcount(array, 2);

borrow(array, array_refcount(array));
borrow_mut(&mut array, array_refcount(array));
Expand Down

0 comments on commit 0925a33

Please sign in to comment.