diff --git a/Cargo.lock b/Cargo.lock index 11764720da8..66dffa03c9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3902,4 +3902,4 @@ dependencies = [ "quote", "syn 1.0.109", "synstructure", -] +] \ No newline at end of file diff --git a/crates/nargo_cli/src/cli/check_cmd.rs b/crates/nargo_cli/src/cli/check_cmd.rs index c57bb2a1fd9..3b877c5a8bf 100644 --- a/crates/nargo_cli/src/cli/check_cmd.rs +++ b/crates/nargo_cli/src/cli/check_cmd.rs @@ -35,8 +35,8 @@ fn check_from_path>( let mut driver = Resolver::resolve_root_manifest( p.as_ref(), backend.np_language(), - #[allow(deprecated)] - Box::new(acvm::default_is_opcode_supported(backend.np_language())), + // TODO: Remove need for driver to be aware of backend. + Box::new(|op| B::default().supports_opcode(op)), )?; driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?; diff --git a/crates/nargo_cli/src/cli/compile_cmd.rs b/crates/nargo_cli/src/cli/compile_cmd.rs index a1cfca8b6ea..a95394aef77 100644 --- a/crates/nargo_cli/src/cli/compile_cmd.rs +++ b/crates/nargo_cli/src/cli/compile_cmd.rs @@ -107,8 +107,8 @@ fn setup_driver( Resolver::resolve_root_manifest( program_dir, backend.np_language(), - #[allow(deprecated)] - Box::new(acvm::default_is_opcode_supported(backend.np_language())), + // TODO: Remove need for driver to be aware of backend. + Box::new(|op| B::default().supports_opcode(op)), ) } diff --git a/crates/nargo_cli/src/cli/test_cmd.rs b/crates/nargo_cli/src/cli/test_cmd.rs index fdb97bfe02d..6a49deb5dd7 100644 --- a/crates/nargo_cli/src/cli/test_cmd.rs +++ b/crates/nargo_cli/src/cli/test_cmd.rs @@ -40,8 +40,8 @@ fn run_tests( let mut driver = Resolver::resolve_root_manifest( program_dir, backend.np_language(), - #[allow(deprecated)] - Box::new(acvm::default_is_opcode_supported(backend.np_language())), + // TODO: Remove need for driver to be aware of backend. + Box::new(|op| B::default().supports_opcode(op)), )?; driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?; diff --git a/crates/noirc_driver/src/lib.rs b/crates/noirc_driver/src/lib.rs index b20f1d59815..444f209a42b 100644 --- a/crates/noirc_driver/src/lib.rs +++ b/crates/noirc_driver/src/lib.rs @@ -28,8 +28,6 @@ pub use program::CompiledProgram; pub struct Driver { context: Context, language: Language, - // We retain this as we need to pass this into `create_circuit` once signature is updated to allow. - #[allow(dead_code)] is_opcode_supported: Box bool>, } @@ -286,14 +284,12 @@ impl Driver { let program = monomorphize(main_function, &self.context.def_interner); let np_language = self.language.clone(); - // TODO: use proper `is_opcode_supported` implementation. - let is_opcode_supported = acvm::default_is_opcode_supported(np_language.clone()); let circuit_abi = if options.experimental_ssa { experimental_create_circuit( program, np_language, - is_opcode_supported, + &self.is_opcode_supported, options.show_ssa, options.show_output, ) @@ -301,7 +297,7 @@ impl Driver { create_circuit( program, np_language, - is_opcode_supported, + &self.is_opcode_supported, options.show_ssa, options.show_output, ) diff --git a/crates/noirc_evaluator/src/lib.rs b/crates/noirc_evaluator/src/lib.rs index 924e6ad3f9d..506b0c2ceba 100644 --- a/crates/noirc_evaluator/src/lib.rs +++ b/crates/noirc_evaluator/src/lib.rs @@ -66,7 +66,7 @@ pub struct Evaluator { pub fn create_circuit( program: Program, np_language: Language, - is_opcode_supported: fn(&AcirOpcode) -> bool, + is_opcode_supported: &impl Fn(&AcirOpcode) -> bool, enable_logging: bool, show_output: bool, ) -> Result<(Circuit, Abi), RuntimeError> { diff --git a/crates/noirc_evaluator/src/ssa_refactor.rs b/crates/noirc_evaluator/src/ssa_refactor.rs index 60eb0efabf2..fabbb4d7cdc 100644 --- a/crates/noirc_evaluator/src/ssa_refactor.rs +++ b/crates/noirc_evaluator/src/ssa_refactor.rs @@ -9,7 +9,7 @@ use crate::errors::RuntimeError; use acvm::{ - acir::circuit::{Circuit, Opcode}, + acir::circuit::{Circuit, Opcode as AcirOpcode}, Language, }; use noirc_abi::Abi; @@ -36,7 +36,7 @@ pub fn optimize_into_acir(program: Program) -> Acir { pub fn experimental_create_circuit( _program: Program, _np_language: Language, - _is_opcode_supported: fn(&Opcode) -> bool, + _is_opcode_supported: &impl Fn(&AcirOpcode) -> bool, _enable_logging: bool, _show_output: bool, ) -> Result<(Circuit, Abi), RuntimeError> {