From d85bf613d3181853f8cbeb2ab17ebea735bc5c99 Mon Sep 17 00:00:00 2001 From: jfecher Date: Thu, 25 Jul 2024 12:32:51 -0500 Subject: [PATCH] chore: Display comptime assertion errors, not Debug (#5605) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description ## Problem\* Resolves ## Summary\* Changes: ``` error: FormatString("No derive function registered for `quote { Default }`", fmtstr<53, (Quoted)>) ┌─ /.../derive/src/main.nr:19:16 │ 19 │ assert(handler.is_some(), f"No derive function registered for `{trait_to_derive}`"); │ ----------------- Assertion failed │ ``` To: ``` error: No derive function registered for `quote { Default }` ┌─ /.../derive/src/main.nr:19:16 │ 19 │ assert(handler.is_some(), f"No derive function registered for `{trait_to_derive}`"); │ ----------------- Assertion failed │ ``` ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/src/hir/comptime/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/noirc_frontend/src/hir/comptime/errors.rs b/compiler/noirc_frontend/src/hir/comptime/errors.rs index b52201146dd..010c41d2385 100644 --- a/compiler/noirc_frontend/src/hir/comptime/errors.rs +++ b/compiler/noirc_frontend/src/hir/comptime/errors.rs @@ -207,7 +207,7 @@ impl<'a> From<&'a InterpreterError> for CustomDiagnostic { } InterpreterError::FailingConstraint { message, location } => { let (primary, secondary) = match message { - Some(msg) => (format!("{msg:?}"), "Assertion failed".into()), + Some(msg) => (format!("{msg}"), "Assertion failed".into()), None => ("Assertion failed".into(), String::new()), }; CustomDiagnostic::simple_error(primary, secondary, location.span)