Skip to content

Commit 716af43

Browse files
committed
fix(dispatch2): Add 'static bound to exec_async
Closes madsmtm#689.
1 parent 171a694 commit 716af43

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/dispatch2/src/queue.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ impl Queue {
226226
/// Submit a function for asynchronous execution on the [Queue].
227227
pub fn exec_async<F>(&self, work: F)
228228
where
229-
F: Send + FnOnce(),
229+
// We need `'static` to make sure any referenced values are borrowed for
230+
// long enough since `work` will be performed asynchronously.
231+
F: Send + FnOnce() + 'static,
230232
{
231233
let work_boxed = Box::into_raw(Box::new(work)).cast();
232234

0 commit comments

Comments
 (0)