Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting panic for 0.13.x #749

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/rune/src/runtime/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,16 @@ impl Value {
vm_write!(f, "{:?}", value);
}
value => {
// reborrow f to avoid moving it
let result =
vm_try!(caller.call_protocol_fn(Protocol::STRING_DEBUG, value.clone(), (f,),));
caller.call_protocol_fn(Protocol::STRING_DEBUG, self.clone(), (&mut *f,));

vm_try!(<()>::from_value(result));
return VmResult::Ok(());
if let VmResult::Ok(result) = result {
vm_try!(<()>::from_value(result));
} else {
let type_info = vm_try!(value.type_info());
vm_write!(f, "<{} object at {:p}>", type_info, value);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion crates/rune/src/runtime/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ impl Vm {
}

#[inline]
#[tracing::instrument(skip(self))]
#[tracing::instrument(skip(self, return_value))]
fn op_return_internal(
&mut self,
return_value: Value,
Expand Down
Loading