Skip to content

Commit 5b79f04

Browse files
committed
change lifetimes to match std
1 parent 53f3925 commit 5b79f04

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/bevy_tasks/src/task_pool.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl TaskPool {
213213
///
214214
pub fn scope<'env, F, T>(&self, f: F) -> Vec<T>
215215
where
216-
F: for<'scope> FnOnce(&'env Scope<'scope, 'env, T>),
216+
F: for<'scope> FnOnce(&'scope Scope<'scope, 'env, T>),
217217
T: Send + 'static,
218218
{
219219
// SAFETY: This safety comment applies to all references transmuted to 'env.
@@ -333,15 +333,15 @@ impl Drop for TaskPool {
333333
/// For more information, see [`TaskPool::scope`].
334334
#[derive(Debug)]
335335
pub struct Scope<'scope, 'env: 'scope, T> {
336-
executor: &'env async_executor::Executor<'env>,
337-
task_scope_executor: &'env async_executor::Executor<'env>,
338-
spawned: &'env ConcurrentQueue<async_executor::Task<T>>,
336+
executor: &'scope async_executor::Executor<'scope>,
337+
task_scope_executor: &'scope async_executor::Executor<'scope>,
338+
spawned: &'scope ConcurrentQueue<async_executor::Task<T>>,
339339
// make `Scope` invariant over 'scope and 'env
340340
scope: PhantomData<&'scope mut &'scope ()>,
341341
env: PhantomData<&'env mut &'env ()>,
342342
}
343343

344-
impl<'scope, 'env, T: Send + 'env> Scope<'scope, 'env, T> {
344+
impl<'scope, 'env, T: Send + 'scope> Scope<'scope, 'env, T> {
345345
/// Spawns a scoped future onto the thread pool. The scope *must* outlive
346346
/// the provided future. The results of the future will be returned as a part of
347347
/// [`TaskPool::scope`]'s return value.
@@ -350,7 +350,7 @@ impl<'scope, 'env, T: Send + 'env> Scope<'scope, 'env, T> {
350350
/// instead.
351351
///
352352
/// For more information, see [`TaskPool::scope`].
353-
pub fn spawn<Fut: Future<Output = T> + 'env + Send>(&self, f: Fut) {
353+
pub fn spawn<Fut: Future<Output = T> + 'scope + Send>(&self, f: Fut) {
354354
let task = self.executor.spawn(f);
355355
// ConcurrentQueue only errors when closed or full, but we never
356356
// close and use an unbouded queue, so it is safe to unwrap
@@ -363,7 +363,7 @@ impl<'scope, 'env, T: Send + 'env> Scope<'scope, 'env, T> {
363363
/// [`Scope::spawn`] instead, unless the provided future needs to run on the scope's thread.
364364
///
365365
/// For more information, see [`TaskPool::scope`].
366-
pub fn spawn_on_scope<Fut: Future<Output = T> + 'env + Send>(&self, f: Fut) {
366+
pub fn spawn_on_scope<Fut: Future<Output = T> + 'scope + Send>(&self, f: Fut) {
367367
let task = self.task_scope_executor.spawn(f);
368368
// ConcurrentQueue only errors when closed or full, but we never
369369
// close and use an unbouded queue, so it is safe to unwrap

0 commit comments

Comments
 (0)