From 0925a332dbaa561aad195c143079588158498dad Mon Sep 17 00:00:00 2001 From: jfecher Date: Thu, 12 Dec 2024 05:37:37 -0600 Subject: [PATCH] fix: Minimal change to avoid reverting entire PR #6685 (#6778) --- compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs | 4 +++- test_programs/execution_success/reference_counts/src/main.nr | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs index d341e5e9c4c..536f2cdb477 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs @@ -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); diff --git a/test_programs/execution_success/reference_counts/src/main.nr b/test_programs/execution_success/reference_counts/src/main.nr index 8de4d0f2508..68b9f2407b9 100644 --- a/test_programs/execution_success/reference_counts/src/main.nr +++ b/test_programs/execution_success/reference_counts/src/main.nr @@ -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));