Skip to content

Commit e06bc45

Browse files
committed
Expand concurrency explanation a bit
1 parent 78f858d commit e06bc45

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

proposals/NNNN-non-escapable.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Returning a non-escapable value from a closure requires explicit lifetime depend
226226

227227
All of the requirements on use of non-escapable values as function arguments and return values also apply to async functions, including those invoked via `async let`.
228228

229-
The closures used in `Task.init` or `Task.detached` are escaping closures and therefore cannot capture non-escapable values.
229+
The closures used in `Task.init`, `Task.detached`, or `TaskGroup.addTask` are escaping closures and therefore cannot capture non-escapable values.
230230

231231
## Source compatibility
232232

@@ -299,9 +299,11 @@ We’ve explicitly excluded class types from being non-escapable. In the future
299299

300300
#### Concurrency
301301

302-
Structured concurrency implies lifetime constraints similar to those outlined in this proposal. It may be appropriate to incorporate `~Escapable` into the structured concurrency primitives.
302+
Structured concurrency implies lifetime constraints similar to those outlined in this proposal.
303+
It may be appropriate to incorporate `~Escapable` into the structured concurrency primitives.
303304

304-
We expect a future proposal will deal with the relationship to `TaskGroup` and other concurrency constructs.
305+
For example, the current `TaskGroup` type is supposed to never be escaped from the local context;
306+
making it `~Escapable` would prevent this type of abuse and possibly enable other optimizations.
305307

306308
#### Global non-escapable types with immortal lifetimes
307309

0 commit comments

Comments
 (0)