Skip to content

Commit 38938aa

Browse files
authored
fix: fix lifetimes in wasm streaming callback (#1874)
fix lifetimes in wasm streaming callback
1 parent fb023e5 commit 38938aa

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/isolate.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1660,7 +1660,12 @@ impl Isolate {
16601660
#[inline(always)]
16611661
pub fn set_wasm_streaming_callback<F>(&mut self, _: F)
16621662
where
1663-
F: UnitType + Fn(&mut PinScope, Local<Value>, WasmStreaming),
1663+
F: UnitType
1664+
+ for<'a, 'b, 'c> Fn(
1665+
&'c mut PinScope<'a, 'b>,
1666+
Local<'a, Value>,
1667+
WasmStreaming,
1668+
),
16641669
{
16651670
unsafe {
16661671
v8__Isolate__SetWasmStreamingCallback(

src/wasm.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,21 @@ impl WasmMemoryObject {
191191
pub(crate) fn trampoline<F>()
192192
-> unsafe extern "C" fn(*const FunctionCallbackInfo)
193193
where
194-
F: UnitType + Fn(&mut PinScope, Local<Value>, WasmStreaming),
194+
F: UnitType
195+
+ for<'a, 'b, 'c> Fn(
196+
&'c mut PinScope<'a, 'b>,
197+
Local<'a, Value>,
198+
WasmStreaming,
199+
),
195200
{
196201
unsafe extern "C" fn c_fn<F>(info: *const FunctionCallbackInfo)
197202
where
198-
F: UnitType + Fn(&mut PinScope, Local<Value>, WasmStreaming),
203+
F: UnitType
204+
+ for<'a, 'b, 'c> Fn(
205+
&'c mut PinScope<'a, 'b>,
206+
Local<'a, Value>,
207+
WasmStreaming,
208+
),
199209
{
200210
let info = unsafe { &*info };
201211
callback_scope!(unsafe scope, info);

0 commit comments

Comments
 (0)