diff --git a/crates/runtime/src/externref.rs b/crates/runtime/src/externref.rs index 44a60ce797..0eed6562b5 100644 --- a/crates/runtime/src/externref.rs +++ b/crates/runtime/src/externref.rs @@ -750,7 +750,7 @@ impl VMExternRefActivationsTable { /// /// It is the responsibility of the caller to not have the pointer outlive /// the stack map lookup trait object. -pub unsafe trait StackMapLookup { +pub unsafe trait StackMapLookup: 'static { /// Lookup the stack map at a program counter (PC) value. fn lookup(&self, pc: usize) -> Option<*const StackMap>; } diff --git a/crates/wasmtime/src/func/typed.rs b/crates/wasmtime/src/func/typed.rs index b0fe8b574f..627c2f9f3f 100644 --- a/crates/wasmtime/src/func/typed.rs +++ b/crates/wasmtime/src/func/typed.rs @@ -207,7 +207,7 @@ unsafe impl WasmTy for Option { unsafe { store .externref_activations_table() - .insert_with_gc(x.inner, &*store.stack_map_lookup()); + .insert_with_gc(x.inner, store.stack_map_lookup()); } abi } else { diff --git a/crates/wasmtime/src/instance.rs b/crates/wasmtime/src/instance.rs index cf807aee6a..56c2ec3f30 100644 --- a/crates/wasmtime/src/instance.rs +++ b/crates/wasmtime/src/instance.rs @@ -524,7 +524,7 @@ impl<'a> Instantiator<'a> { externref_activations_table: self.store.externref_activations_table() as *const VMExternRefActivationsTable as *mut _, - stack_map_lookup: Some(std::mem::transmute(self.store.stack_map_lookup())), + stack_map_lookup: Some(self.store.stack_map_lookup()), })?; // After we've created the `InstanceHandle` we still need to run diff --git a/crates/wasmtime/src/trampoline.rs b/crates/wasmtime/src/trampoline.rs index 1590bf444a..21eac2a134 100644 --- a/crates/wasmtime/src/trampoline.rs +++ b/crates/wasmtime/src/trampoline.rs @@ -77,7 +77,7 @@ fn create_handle( externref_activations_table: store.externref_activations_table() as *const VMExternRefActivationsTable as *mut _, - stack_map_lookup: Some(std::mem::transmute(store.stack_map_lookup())), + stack_map_lookup: Some(store.stack_map_lookup()), }, )?; diff --git a/crates/wasmtime/src/values.rs b/crates/wasmtime/src/values.rs index 9e10f0aa83..477f0e36b8 100644 --- a/crates/wasmtime/src/values.rs +++ b/crates/wasmtime/src/values.rs @@ -98,7 +98,7 @@ impl Val { let externref_ptr = x.inner.as_raw(); store .externref_activations_table() - .insert_with_gc(x.inner, &*store.stack_map_lookup()); + .insert_with_gc(x.inner, store.stack_map_lookup()); ptr::write(p as *mut *mut u8, externref_ptr) } Val::FuncRef(f) => ptr::write(