lucifer1004 commented on code in PR #814:
URL: https://github.com/apache/tvm-ffi/pull/814#discussion_r4109318662


##########
rust/tvm-ffi/src/function.rs:
##########
@@ -81,17 +81,7 @@ impl<F: Fn(&[AnyView]) -> Result<Any> + 'static> 
CallbackFunctionObjImpl<F> {
     ) -> i32 {
         let this = &*(handle as *mut Self);
         let packed_args = std::slice::from_raw_parts(args as *const AnyView, 
num_args as usize);
-        let ret_value = (this.callback)(packed_args);
-        match ret_value {
-            Ok(value) => {

Review Comment:
   Done in 9126fdc, following your sketch: the helper that took a closure is 
gone. There is a non-generic `panic_to_error(payload) -> Error` in 
`function_internal.rs`, and both boundaries (the export macro and 
`CallbackFunctionObjImpl::invoke_callback`) call `catch_unwind` themselves and 
keep the original `match`. A caught panic is raised as `InternalError`, with a 
new `INTERNAL_ERROR` kind matching C++ `TVM_FFI_ICHECK`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to