From ec0e0a17cfcc3c718814e7f3988f9fa8b218c900 Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Wed, 14 Jun 2023 09:40:30 -0500 Subject: [PATCH] Fix #1645 --- crates/nargo_cli/src/cli/compile_cmd.rs | 14 ++++++++++---- .../src/ssa_refactor/opt/inlining.rs | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/nargo_cli/src/cli/compile_cmd.rs b/crates/nargo_cli/src/cli/compile_cmd.rs index d2b5532cf24..1d867675556 100644 --- a/crates/nargo_cli/src/cli/compile_cmd.rs +++ b/crates/nargo_cli/src/cli/compile_cmd.rs @@ -2,6 +2,7 @@ use acvm::Backend; use iter_extended::try_vecmap; use nargo::artifacts::contract::PreprocessedContract; use noirc_driver::{CompileOptions, CompiledProgram, Driver}; +use noirc_errors::reporter; use std::path::Path; use clap::Args; @@ -49,9 +50,11 @@ pub(crate) fn run( // If contracts is set we're compiling every function in a 'contract' rather than just 'main'. if args.contracts { let mut driver = setup_driver(backend, &config.program_dir)?; - let compiled_contracts = driver - .compile_contracts(&args.compile_options) - .map_err(|_| CliError::CompilationError)?; + let compiled_contracts = + driver.compile_contracts(&args.compile_options).map_err(|errors| { + reporter::report_all(driver.file_manager(), &errors, false); + CliError::CompilationError + })?; // TODO(#1389): I wonder if it is incorrect for nargo-core to know anything about contracts. // As can be seen here, It seems like a leaky abstraction where ContractFunctions (essentially CompiledPrograms) @@ -118,5 +121,8 @@ pub(crate) fn compile_circuit( compile_options: &CompileOptions, ) -> Result> { let mut driver = setup_driver(backend, program_dir)?; - driver.compile_main(compile_options).map_err(|_| CliError::CompilationError) + driver.compile_main(compile_options).map_err(|errors| { + reporter::report_all(driver.file_manager(), &errors, false); + CliError::CompilationError + }) } diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs b/crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs index bfb4911f1c2..80e491e79f1 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs +++ b/crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs @@ -263,7 +263,7 @@ impl<'function> PerFunctionContext<'function> { _ => { self.context.failed_to_inline_a_call = true; None - }, + } } }