Skip to content

Commit 0fa14c8

Browse files
authored
Fix wrong transmuted type in TaskPool::scope_with_executor_inner (#11455)
# Objective #8219 changed the target type of a `transmute` without changing the one transmuting from ([see the relevant diff](55e9ab7#diff-11413fb2eeba97978379d325353d32aa76eefd0af0c8e9b50b7f394ddfda7a26R351-R355)), making them incompatible. This PR fixes this by changing the initial type to match the target one (modulo lifetimes). ## Solution Change the type to be transmuted from to match the one transmuting into (modulo lifetimes)
1 parent 18833fa commit 0fa14c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/bevy_tasks/src/task_pool.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ impl TaskPool {
360360
unsafe { mem::transmute(external_executor) };
361361
// SAFETY: As above, all futures must complete in this function so we can change the lifetime
362362
let scope_executor: &'env ThreadExecutor<'env> = unsafe { mem::transmute(scope_executor) };
363-
let spawned: ConcurrentQueue<FallibleTask<T>> = ConcurrentQueue::unbounded();
363+
let spawned: ConcurrentQueue<FallibleTask<Result<T, Box<(dyn std::any::Any + Send)>>>> =
364+
ConcurrentQueue::unbounded();
364365
// shadow the variable so that the owned value cannot be used for the rest of the function
365366
// SAFETY: As above, all futures must complete in this function so we can change the lifetime
366367
let spawned: &'env ConcurrentQueue<

0 commit comments

Comments
 (0)