From a791a0c34111313e97b677598c9dc92508db4305 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 4 Aug 2025 11:34:06 +0000 Subject: [PATCH 1/2] chore: address TODO comments --- compiler/noirc_evaluator/src/acir/mod.rs | 14 +++++--------- compiler/noirc_evaluator/src/errors.rs | 5 +---- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/compiler/noirc_evaluator/src/acir/mod.rs b/compiler/noirc_evaluator/src/acir/mod.rs index 0b39c59d270..98047c1decb 100644 --- a/compiler/noirc_evaluator/src/acir/mod.rs +++ b/compiler/noirc_evaluator/src/acir/mod.rs @@ -806,17 +806,13 @@ impl<'a> Context<'a> { let outputs = self .convert_ssa_intrinsic_call(*intrinsic, arguments, dfg, result_ids)?; - // Issue #1438 causes this check to fail with intrinsics that return 0 - // results but the ssa form instead creates 1 unit result value. - // assert_eq!(result_ids.len(), outputs.len()); + assert_eq!(result_ids.len(), outputs.len()); self.handle_ssa_call_outputs(result_ids, outputs, dfg)?; } - Value::ForeignFunction(_) => { - // TODO: Remove this once elaborator is default frontend. This is now caught by a lint inside the frontend. - return Err(RuntimeError::UnconstrainedOracleReturnToConstrained { - call_stack: self.acir_context.get_call_stack(), - }); - } + Value::ForeignFunction(_) => unreachable!( + "Frontend should remove any oracle calls from constrained functions" + ), + _ => unreachable!("expected calling a function but got {function_value:?}"), } } diff --git a/compiler/noirc_evaluator/src/errors.rs b/compiler/noirc_evaluator/src/errors.rs index 508c8c18360..919c95f3a14 100644 --- a/compiler/noirc_evaluator/src/errors.rs +++ b/compiler/noirc_evaluator/src/errors.rs @@ -64,8 +64,6 @@ pub enum RuntimeError { BigIntModulus { call_stack: CallStack }, #[error("Slices cannot be returned from an unconstrained runtime to a constrained runtime")] UnconstrainedSliceReturnToConstrained { call_stack: CallStack }, - #[error("All `oracle` methods should be wrapped in an unconstrained fn")] - UnconstrainedOracleReturnToConstrained { call_stack: CallStack }, #[error( "Could not resolve some references to the array. All references must be resolved at compile time" )] @@ -78,7 +76,7 @@ pub enum RuntimeError { "Cannot return a function from an if or match expression, or assignment within these expressions" )] ReturnedFunctionFromDynamicIf { call_stack: CallStack }, - /// This case is not an error. It's used during codegen to prevent inserting instructions after + /// This case is not an error. It's used during codegen to prevent inserting instructions after\ /// code when a break or continue is generated. #[error("Break or continue")] BreakOrContinue { call_stack: CallStack }, @@ -200,7 +198,6 @@ impl RuntimeError { | RuntimeError::NestedSlice { call_stack, .. } | RuntimeError::BigIntModulus { call_stack, .. } | RuntimeError::UnconstrainedSliceReturnToConstrained { call_stack } - | RuntimeError::UnconstrainedOracleReturnToConstrained { call_stack } | RuntimeError::ReturnedReferenceFromDynamicIf { call_stack } | RuntimeError::ReturnedFunctionFromDynamicIf { call_stack } | RuntimeError::BreakOrContinue { call_stack } From f3483a3662a69adcdc384f3954f55ef0df59dfca Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 4 Aug 2025 13:25:15 +0100 Subject: [PATCH 2/2] Update compiler/noirc_evaluator/src/errors.rs Co-authored-by: Ary Borenszweig --- compiler/noirc_evaluator/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/noirc_evaluator/src/errors.rs b/compiler/noirc_evaluator/src/errors.rs index 919c95f3a14..7ff611d4421 100644 --- a/compiler/noirc_evaluator/src/errors.rs +++ b/compiler/noirc_evaluator/src/errors.rs @@ -76,7 +76,7 @@ pub enum RuntimeError { "Cannot return a function from an if or match expression, or assignment within these expressions" )] ReturnedFunctionFromDynamicIf { call_stack: CallStack }, - /// This case is not an error. It's used during codegen to prevent inserting instructions after\ + /// This case is not an error. It's used during codegen to prevent inserting instructions after /// code when a break or continue is generated. #[error("Break or continue")] BreakOrContinue { call_stack: CallStack },