smol-rs / async-executor

Async executor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Removing lifetime parameter for Executor and LocalExecutor

IGreyGooI opened this issue · comments

What is the point of it? It is not reasonable to statically track the lifetime of Executor which only contain a Arc.

IIUC, this is needed to spawn a non-static future: f9e28cd

/// Makes the `'a` lifetime invariant.
_marker: PhantomData<std::cell::UnsafeCell<&'a ()>>,

let task: Task<&str> = ex.spawn(async { &*s });

See also safety requirements of async_task::spawn_unchecked