For error handling and breakpoints, use Box<Any + Send> instead of Box<Any>.

This commit is contained in:
Nick Lewycky
2019-12-09 18:22:30 -08:00
parent 12daaba3fd
commit 0a278c55ee
12 changed files with 36 additions and 34 deletions

View File

@ -66,7 +66,7 @@ extern "C" {
params: *const u64,
results: *mut u64,
trap_out: *mut WasmTrapInfo,
user_error: *mut Option<Box<dyn Any>>,
user_error: *mut Option<Box<dyn Any + Send>>,
invoke_env: Option<NonNull<c_void>>,
) -> bool;
}
@ -427,7 +427,7 @@ impl RunnableModule for LLVMBackend {
self.msm.clone()
}
unsafe fn do_early_trap(&self, data: Box<dyn Any>) -> ! {
unsafe fn do_early_trap(&self, data: Box<dyn Any + Send>) -> ! {
throw_any(Box::leak(data))
}
}

View File

@ -856,7 +856,8 @@ pub unsafe extern "C" fn callback_trampoline(
callback: *mut BreakpointHandler,
) {
let callback = Box::from_raw(callback);
let result: Result<(), Box<dyn std::any::Any>> = callback(BreakpointInfo { fault: None });
let result: Result<(), Box<dyn std::any::Any + Send>> =
callback(BreakpointInfo { fault: None });
match result {
Ok(()) => *b = None,
Err(e) => *b = Some(e),