From d20cde8d7e621f58f28428d4daae38a3f6aa5174 Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Wed, 11 Dec 2024 14:26:56 -0600 Subject: [PATCH 1/3] Minimal change to avoid reverting entire PR --- compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs index d341e5e9c4..739cdf419a 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); From e2c72b9eb8b38896649ba34c140c36c0fea5dd7d Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Wed, 11 Dec 2024 14:42:57 -0600 Subject: [PATCH 2/3] Update expected rc --- test_programs/execution_success/reference_counts/src/main.nr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_programs/execution_success/reference_counts/src/main.nr b/test_programs/execution_success/reference_counts/src/main.nr index 8de4d0f250..68b9f2407b 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)); From 85fb214fcf590e24b518a9514a2a99a9e1ec2a4f Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Wed, 11 Dec 2024 14:46:40 -0600 Subject: [PATCH 3/3] format --- compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs index 739cdf419a..536f2cdb47 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs @@ -705,7 +705,7 @@ impl<'a> FunctionContext<'a> { // we consider the array to be moved, so we should have an initial rc of just 1. // // TODO: this exception breaks #6763 - let should_inc_rc = true;// !let_expr.expression.is_array_or_slice_literal(); + let should_inc_rc = true; // !let_expr.expression.is_array_or_slice_literal(); values = values.map(|value| { let value = value.eval(self);