Skip to content

Commit

Permalink
Make the defaulted trait object lifetime bounds in allow_threads expl…
Browse files Browse the repository at this point in the history
…icit to make the transmute call more obvious.
  • Loading branch information
adamreichold committed Dec 14, 2023
1 parent b703d9f commit 292bca3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl<'py> Python<'py> {
// access thread-local storage from the current thread.

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

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

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

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

0 comments on commit 292bca3

Please sign in to comment.