@@ -5,6 +5,39 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
5
5
6
6
## Swift 5.7
7
7
8
+ * [ SE-0338] [ ] :
9
+
10
+ Non-isolated async functions now always execute on the global concurrent pool,
11
+ so calling a non-isolated async function from actor-isolated code will leave
12
+ the actor. For example:
13
+
14
+ ``` swift
15
+ class C { }
16
+
17
+ func f (_ : C) async { /* always executes on the global concurrent pool */ }
18
+
19
+ actor A {
20
+ func g (c : C) async {
21
+ /* always executes on the actor */
22
+ print (" on the actor" )
23
+
24
+ await f (c)
25
+ }
26
+ }
27
+ ```
28
+
29
+ Prior to this change, the call from ` f ` to ` g ` might have started execution of
30
+ ` g ` on the actor, which could lead to actors being busy longer than strictly
31
+ necessary. Now, the non-isolated async function will always hop to the global
32
+ cooperative pool, not run on the actor. This can result in a behavior change
33
+ for programs that assumed that a non-isolated async function called from a
34
+ ` @MainActor ` context will be executed on the main actor, although such
35
+ programs were already technically incorrect.
36
+
37
+ Additionally, when leaving an actor to execution on the global cooperative
38
+ pool, ` Sendable ` checking will be performed, so the compiler will emit a
39
+ diagnostic in the call to ` f ` if ` c ` is not of ` Sendable ` type.
40
+
8
41
* [ SE-0350] [ ] :
9
42
10
43
The standard library has a new ` Regex<Output> ` type.
@@ -9421,6 +9454,7 @@ Swift 1.0
9421
9454
[SE- 0335 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md>
9422
9455
[SE- 0336 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0336-distributed-actor-isolation.md>
9423
9456
[SE- 0337 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0337-support-incremental-migration-to-concurrency-checking.md>
9457
+ [SE- 0338 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0338-clarify-execution-non-actor-async.md>
9424
9458
[SE- 0340 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0340-swift-noasync.md>
9425
9459
[SE- 0341 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0341-opaque-parameters.md>
9426
9460
[SE- 0343 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0343-top-level-concurrency.md>
0 commit comments