You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/NNNN-non-escapable.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,7 +226,7 @@ Returning a non-escapable value from a closure requires explicit lifetime depend
226
226
227
227
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`.
228
228
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.
230
230
231
231
## Source compatibility
232
232
@@ -299,9 +299,11 @@ We’ve explicitly excluded class types from being non-escapable. In the future
299
299
300
300
#### Concurrency
301
301
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.
303
304
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.
305
307
306
308
#### Global non-escapable types with immortal lifetimes
0 commit comments