diff --git a/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs b/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs index 8a91d301d7e..0313dac741d 100644 --- a/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs +++ b/compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs @@ -539,14 +539,17 @@ fn function_id_to_field(function_id: FunctionId) -> FieldElement { /// The [FunctionId] of the new apply function /// /// # Panics -/// If the `function_ids` argument is empty. +/// If the `function_ids` argument has fewer than two elements, implying that no apply function is necessary. fn create_apply_function( ssa: &mut Ssa, signature: Signature, caller_runtime: RuntimeType, function_ids: Vec<(FunctionId, RuntimeType)>, ) -> FunctionId { - assert!(!function_ids.is_empty()); + assert!( + function_ids.len() > 1, + "create_apply_function is expected to be called with two or more FunctionIds" + ); // Clone the user-defined globals and the function purities mapping, // which are shared across all functions. // We will be borrowing `ssa` mutably so we need to fetch this shared information