From 56001856bed44b4debfedde19f949e5f0b16efec Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Tue, 24 Sep 2024 12:30:26 -0700 Subject: [PATCH] Manually implement Debug for MethodInst MethodInst's self_binding was causing endless recursion issues, this just skips over it and uses the normal formatting for it Signed-off-by: Alek Ratzloff --- src/obj/function.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/obj/function.rs b/src/obj/function.rs index 556a4ec..c36dcb2 100644 --- a/src/obj/function.rs +++ b/src/obj/function.rs @@ -223,13 +223,23 @@ impl Obj for UserFunctionInst { // MethodInst //////////////////////////////////////////////////////////////////////////////// -#[derive(Debug, Trace)] +#[derive(Trace)] pub struct MethodInst { base: BaseObjInst, self_binding: ObjP, function: ObjP, } +impl Debug for MethodInst { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("MethodInst") + .field("base", &self.base) + .field("self_binding", &format!("{}", self.self_binding.borrow())) + .field("function", &self.function) + .finish() + } +} + impl MethodInst { pub fn new(self_binding: ObjP, function: ObjP) -> Self { Self {