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

@ -26,12 +26,12 @@ pub use self::unix::*;
pub use self::windows::*;
thread_local! {
pub static TRAP_EARLY_DATA: Cell<Option<Box<dyn Any>>> = Cell::new(None);
pub static TRAP_EARLY_DATA: Cell<Option<Box<dyn Any + Send>>> = Cell::new(None);
}
pub enum CallProtError {
Trap(WasmTrapInfo),
Error(Box<dyn Any>),
Error(Box<dyn Any + Send>),
}
pub struct Caller {
@ -67,7 +67,7 @@ impl RunnableModule for Caller {
args: *const u64,
rets: *mut u64,
trap_info: *mut WasmTrapInfo,
user_error: *mut Option<Box<dyn Any>>,
user_error: *mut Option<Box<dyn Any + Send>>,
invoke_env: Option<NonNull<c_void>>,
) -> bool {
let handler_data = &*invoke_env.unwrap().cast().as_ptr();
@ -108,7 +108,7 @@ impl RunnableModule for Caller {
})
}
unsafe fn do_early_trap(&self, data: Box<dyn Any>) -> ! {
unsafe fn do_early_trap(&self, data: Box<dyn Any + Send>) -> ! {
TRAP_EARLY_DATA.with(|cell| cell.set(Some(data)));
trigger_trap()
}