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
// Just to show that without the transferring param, we generate diagnostics.
46
46
letx2=NSObject()
47
47
lety2=returnNSObjectFromGlobalFunction(x2)
48
-
awaittransferToMain(x2) // expected-error {{transferring 'x2' may cause a race}}
48
+
awaittransferToMain(x2) // expected-error {{transferring 'x2' may cause a data race}}
49
49
// expected-note @-1 {{transferring disconnected 'x2' to main actor-isolated callee could cause races in between callee main actor-isolated and local nonisolated uses}}
50
50
useValue(y2) // expected-note {{use here could race}}
51
51
}
52
52
53
53
func funcTestTransferringArg()async{
54
54
letx=NSObject()
55
-
transferNSObjectToGlobalFunction(x) // expected-error {{transferring 'x' may cause a race}}
55
+
transferNSObjectToGlobalFunction(x) // expected-error {{transferring 'x' may cause a data race}}
56
56
// expected-note @-1 {{'x' used after being passed as a transferring parameter; Later uses could race}}
57
57
useValue(x) // expected-note {{use here could race}}
// error: unexpected warning produced: transferring 'body' may cause a race; this is an error in the Swift 6 language mode
21
+
// error: unexpected warning produced: transferring 'body' may cause a data race; this is an error in the Swift 6 language mode
22
22
// error: unexpected note produced: actor-isolated 'body' is captured by a actor-isolated closure. actor-isolated uses in closure may race against later nonisolated uses
// FIXME: Region isolation should consider a value from a 'nonisolated(unsafe)'
32
32
// declaration to be in a disconnected region
33
33
34
-
// expected-region-isolation-warning @+3 {{transferring 'it' may cause a race}}
34
+
// expected-region-isolation-warning @+3 {{transferring 'it' may cause a data race}}
35
35
// expected-region-isolation-note @+2 {{transferring disconnected 'it' to nonisolated callee could cause races in between callee nonisolated and local main actor-isolated uses}}
36
36
// expected-region-isolation-note @+1 {{use here could race}}
Copy file name to clipboardExpand all lines: test/Concurrency/isolated_captures.swift
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ class NotSendable {
40
40
MyActor.ns = ns
41
41
42
42
await{@YourActorin
43
-
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a race}}
43
+
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a data race}}
44
44
// expected-region-isolation-note @+2 {{global actor 'MyActor'-isolated 'ns' is captured by a global actor 'YourActor'-isolated closure. global actor 'YourActor'-isolated uses in closure may race against later global actor 'MyActor'-isolated uses}}
45
45
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in the Swift 6 language mode}}
46
46
YourActor.ns = ns
@@ -62,7 +62,7 @@ class NotSendable {
62
62
ns.stash()
63
63
64
64
await{@YourActorin
65
-
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a race}}
65
+
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a data race}}
66
66
// expected-region-isolation-note @+2 {{global actor 'MyActor'-isolated 'ns' is captured by a global actor 'YourActor'-isolated closure. global actor 'YourActor'-isolated uses in closure may race against later global actor 'MyActor'-isolated uses}}
67
67
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in the Swift 6 language mode}}
68
68
YourActor.ns = ns
@@ -83,7 +83,7 @@ class NotSendable {
83
83
letns=NotSendable()
84
84
85
85
await{@YourActorin
86
-
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a race}}
86
+
// expected-region-isolation-warning @+3 {{transferring 'ns' may cause a data race}}
87
87
// expected-region-isolation-note @+2 {{global actor 'MyActor'-isolated 'ns' is captured by a global actor 'YourActor'-isolated closure. global actor 'YourActor'-isolated uses in closure may race against later global actor 'MyActor'-isolated uses}}
88
88
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in the Swift 6 language mode}}
Copy file name to clipboardExpand all lines: test/Concurrency/sendable_checking.swift
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -96,7 +96,7 @@ public actor MyActor: MyProto {
96
96
97
97
func g(ns1:NS1)async{
98
98
awaitnonisolatedAsyncFunc1(ns1) // expected-targeted-and-complete-warning{{passing argument of non-sendable type 'NS1' outside of actor-isolated context may introduce data races}}
99
-
// expected-tns-warning @-1 {{transferring 'ns1' may cause a race}}
99
+
// expected-tns-warning @-1 {{transferring 'ns1' may cause a data race}}
100
100
// expected-tns-note @-2 {{transferring actor-isolated 'ns1' to nonisolated callee could cause races between nonisolated and actor-isolated uses}}
101
101
_ =awaitnonisolatedAsyncFunc2() // expected-warning{{non-sendable type 'NS1' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary}}
102
102
}
@@ -253,12 +253,12 @@ final class NonSendable {
253
253
func call()async{
254
254
awaitupdate()
255
255
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
256
-
// expected-tns-warning @-2 {{transferring 'self' may cause a race}}
256
+
// expected-tns-warning @-2 {{transferring 'self' may cause a data race}}
257
257
// expected-tns-note @-3 {{transferring task-isolated 'self' to main actor-isolated callee could cause races between main actor-isolated and task-isolated uses}}
258
258
259
259
awaitself.update()
260
260
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
261
-
// expected-tns-warning @-2 {{transferring 'self' may cause a race}}
261
+
// expected-tns-warning @-2 {{transferring 'self' may cause a data race}}
262
262
// expected-tns-note @-3 {{transferring task-isolated 'self' to main actor-isolated callee could cause races between main actor-isolated and task-isolated uses}}
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
280
-
// expected-tns-warning @-2 {{transferring 't' may cause a race}}
280
+
// expected-tns-warning @-2 {{transferring 't' may cause a data race}}
281
281
// expected-tns-note @-3 {{transferring disconnected 't' to main actor-isolated callee could cause races in between callee main actor-isolated and local nonisolated uses}}
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
300
-
// expected-tns-warning @-2 {{transferring 'ns' may cause a race}}
300
+
// expected-tns-warning @-2 {{transferring 'ns' may cause a data race}}
301
301
// expected-tns-note @-3 {{transferring main actor-isolated 'ns' to nonisolated callee could cause races between nonisolated and main actor-isolated uses}}
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
306
-
// expected-tns-warning @-2 {{transferring 'ns' may cause a race}}
306
+
// expected-tns-warning @-2 {{transferring 'ns' may cause a data race}}
307
307
// expected-tns-note @-3 {{transferring main actor-isolated 'ns' to nonisolated callee could cause races between nonisolated and main actor-isolated uses}}
0 commit comments