Skip to content

Commit

Permalink
add another compile fail test
Browse files Browse the repository at this point in the history
  • Loading branch information
hymm committed Apr 16, 2022
1 parent 88331ca commit f24d363
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crates/bevy_tasks/src/task_pool.rs
Expand Up @@ -177,7 +177,7 @@ impl TaskPool {
///
/// ```compile_fail
/// use bevy_tasks::TaskPool;
/// fn compile_fail() {
/// fn scope_escapes_closure() {
/// let pool = TaskPool::new();
/// let foo = Box::new(42);
/// pool.scope(|scope| {
Expand All @@ -190,6 +190,20 @@ impl TaskPool {
/// });
/// }
/// ```
///
/// ```compile_fail
/// use bevy_tasks::TaskPool;
/// fn cannot_borrow_from_closure() {
/// let pool = TaskPool::new();
/// pool.scope(|scope| {
/// let x = 1;
/// let y = &x;
/// scope.spawn(async move {
/// assert_eq!(*y, 1);
/// });
/// });
/// }
///
pub fn scope<'env, F, T>(&self, f: F) -> Vec<T>
where
F: for<'scope> FnOnce(&'env Scope<'scope, 'env, T>),
Expand Down

0 comments on commit f24d363

Please sign in to comment.