From 26cce04c57fcb1cd4d5abce16b9d74a53e185ba8 Mon Sep 17 00:00:00 2001 From: Arvid Norlander Date: Wed, 17 Jul 2024 10:23:00 +0200 Subject: [PATCH 1/2] rune: Do not trace return value (causes panic on Result:Err) --- crates/rune/src/runtime/vm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/rune/src/runtime/vm.rs b/crates/rune/src/runtime/vm.rs index ad693e15d..2ad362f3f 100644 --- a/crates/rune/src/runtime/vm.rs +++ b/crates/rune/src/runtime/vm.rs @@ -2239,7 +2239,7 @@ impl Vm { } #[inline] - #[tracing::instrument(skip(self))] + #[tracing::instrument(skip(self, return_value))] fn op_return_internal(&mut self, return_value: Value) -> VmResult> { let (exit, out) = vm_try!(self.pop_call_frame()); From aa360a9460b160743473b6155aa062d7edf4ac1e Mon Sep 17 00:00:00 2001 From: Arvid Norlander Date: Wed, 17 Jul 2024 12:28:40 +0200 Subject: [PATCH 2/2] rune: Never error in Value debug formatting Instead attempt to print *something* --- crates/rune/src/runtime/value.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/rune/src/runtime/value.rs b/crates/rune/src/runtime/value.rs index 43e5487cc..98414683c 100644 --- a/crates/rune/src/runtime/value.rs +++ b/crates/rune/src/runtime/value.rs @@ -2137,7 +2137,15 @@ impl fmt::Debug for Value { let mut o = Formatter::new(); if self.string_debug(&mut o).is_err() { - return Err(fmt::Error); + match self.type_info() { + Ok(type_info) => { + write!(f, "<{} object at {:p}>", type_info, self)?; + } + Err(e) => { + write!(f, "", self, e)?; + } + } + return Ok(()); } f.write_str(o.as_str())?;