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: test/Concurrency/transfernonsendable_isolationcrossing_partialapply.swift
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,8 @@ actor ProtectsNonSendable {
65
65
66
66
// This is not safe since we use l later.
67
67
self.assumeIsolated{ isolatedSelf in
68
-
isolatedSelf.ns = l // expected-warning {{actor-isolated closure captures value of non-Sendable type 'NonSendableKlass' from nonisolated context; later accesses to value could race}}
68
+
isolatedSelf.ns = l // expected-warning {{transferring 'l' may cause a race}}
69
+
// expected-note @-1 {{disconnected 'l' is captured by actor-isolated closure. actor-isolated uses in closure may race against later nonisolated uses}}
69
70
}
70
71
71
72
useValue(l) // expected-note {{use here could race}}
@@ -82,7 +83,8 @@ func normalFunc_testLocal_1() {
82
83
func normalFunc_testLocal_2(){
83
84
letx=NonSendableKlass()
84
85
let _ ={@MainActorin
85
-
useValue(x) // expected-warning {{main actor-isolated closure captures value of non-Sendable type 'NonSendableKlass' from nonisolated context; later accesses to value could race}}
86
+
useValue(x) // expected-warning {{transferring 'x' may cause a race}}
87
+
// expected-note @-1 {{disconnected 'x' is captured by main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses}}
86
88
}
87
89
useValue(x) // expected-note {{use here could race}}
print(x) // expected-error {{main actor-isolated closure captures value of non-Sendable type 'NonSendableType' from nonisolated context; later accesses to value could race}}
52
+
print(x) // expected-error {{transferring 'x' may cause a race}}
53
+
// expected-note @-1 {{disconnected 'x' is captured by main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses}}
53
54
}
54
55
useValue(x) // expected-note {{use here could race}}
0 commit comments