From c4e0fd78b49f000145dde98bb16d37aa2e9c9784 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 11 Mar 2024 22:15:23 +0000 Subject: [PATCH 1/2] update can_omit_element_sizes_array to not operate over slices --- compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs index 8d4d066853..f14501ad01 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs @@ -2268,10 +2268,7 @@ impl Context { // We can omit the element size array for arrays which don't contain arrays or slices. fn can_omit_element_sizes_array(array_typ: &Type) -> bool { - if array_typ.contains_slice_element() { - return false; - } - let Type::Array(types, _) = array_typ else { + let (Type::Array(types, _) | Type::Slice(types)) = array_typ else { panic!("ICE: expected array type"); }; From cc82f268d25ea28ebb86ecdc54b2929faad29289 Mon Sep 17 00:00:00 2001 From: vezenovm Date: Mon, 11 Mar 2024 22:17:55 +0000 Subject: [PATCH 2/2] switch to match statement --- compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs b/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs index f14501ad01..140ed0b53f 100644 --- a/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs +++ b/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs @@ -2268,8 +2268,9 @@ impl Context { // We can omit the element size array for arrays which don't contain arrays or slices. fn can_omit_element_sizes_array(array_typ: &Type) -> bool { - let (Type::Array(types, _) | Type::Slice(types)) = array_typ else { - panic!("ICE: expected array type"); + let types = match array_typ { + Type::Array(types, _) | Type::Slice(types) => types, + _ => panic!("ICE: expected array or slice type"), }; !types.iter().any(|typ| typ.contains_an_array())