Skip to content

Commit 292bca3

Browse files
committed
Make the defaulted trait object lifetime bounds in allow_threads explicit to make the transmute call more obvious.
1 parent b703d9f commit 292bca3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/marker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl<'py> Python<'py> {
336336
// access thread-local storage from the current thread.
337337

338338
// 1. Construct a task
339-
struct Task(*mut dyn FnMut());
339+
struct Task(*mut (dyn FnMut() + 'static));
340340
unsafe impl Send for Task {}
341341

342342
let (result_sender, result_receiver) = sync_channel::<Result<T>>(0);
@@ -356,7 +356,7 @@ impl<'py> Python<'py> {
356356
};
357357

358358
// SAFETY: the current thread will block until the closure has returned
359-
let mut task = Task(unsafe { transmute(&mut task as &mut dyn FnMut()) });
359+
let mut task = Task(unsafe { transmute(&mut task as &mut (dyn FnMut() + '_)) });
360360

361361
// 2. Dispatch task to waiting thread, spawn new thread if necessary
362362
let trap = PanicTrap::new(

0 commit comments

Comments
 (0)