Skip to content

Commit 3641050

Browse files
committed
[region-isolation] Wordsmith some diagnostics.
I tried to make them shorter and standardized on "; later accesses could race" as the mark on a diagnostic that the problem was that a race was occuring (before we had several small different variations).
1 parent fd14a97 commit 3641050

10 files changed

+224
-224
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,16 +893,16 @@ NOTE(sil_referencebinding_inout_binding_here, none,
893893
WARNING(regionbasedisolation_selforargtransferred, none,
894894
"call site passes `self` or a non-sendable argument of this function to another thread, potentially yielding a race with the caller", ())
895895
WARNING(regionbasedisolation_transfer_yields_race_no_isolation, none,
896-
"transferred value of non-Sendable type %0 that could race with later accesses",
896+
"transferring value of non-Sendable type %0; later accesses could race",
897897
(Type))
898898
WARNING(regionbasedisolation_transfer_yields_race_with_isolation, none,
899-
"passing argument of non-sendable type %0 from %1 context to %2 context at this call site could yield a race with accesses later in this function",
899+
"transferring value of non-Sendable type %0 from %1 context to %2 context; later accesses could race",
900900
(Type, ActorIsolation, ActorIsolation))
901901
WARNING(regionbasedisolation_transfer_yields_race_transferring_parameter, none,
902-
"transferred value of non-Sendable type %0 into transferring parameter; later accesses could result in races",
902+
"transferring value of non-Sendable type %0 into transferring parameter; later accesses could race",
903903
(Type))
904904
WARNING(regionbasedisolation_transfer_yields_race_stronglytransferred_binding, none,
905-
"binding of non-Sendable type %0 accessed after being transferred; later accesses could result in races",
905+
"binding of non-Sendable type %0 accessed after being transferred; later accesses could race",
906906
(Type))
907907
NOTE(regionbasedisolation_maybe_race, none,
908908
"access here could race", ())

test/Concurrency/experimental_feature_strictconcurrency.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ func iterate(stream: AsyncStream<Int>) async {
3131
// FIXME: Region isolation should consider a value from a 'nonisolated(unsafe)'
3232
// declaration to be in a disconnected region
3333

34-
// expected-region-isolation-warning@+2 {{passing argument of non-sendable type 'AsyncStream<Int>.Iterator' from main actor-isolated context to nonisolated context at this call site could yield a race with accesses later in this function}}
34+
// expected-region-isolation-warning@+2 {{transferring value of non-Sendable type 'AsyncStream<Int>.Iterator' from main actor-isolated context to nonisolated context; later accesses could race}}
3535
// expected-region-isolation-note@+1 {{access here could race}}
3636
while let element = await it.next() {
3737
print(element)
3838
}
3939

40-
// expected-region-isolation-warning@+2 {{passing argument of non-sendable type 'AsyncStream<Int>.Iterator' from main actor-isolated context to nonisolated context at this call site could yield a race with accesses later in this function}}
40+
// expected-region-isolation-warning@+2 {{transferring value of non-Sendable type 'AsyncStream<Int>.Iterator' from main actor-isolated context to nonisolated context; later accesses could race}}
4141
// expected-region-isolation-note@+1 {{access here could race}}
4242
for await x in stream {
4343
print(x)

test/Concurrency/sendable_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ func testNonSendableBaseArg() async {
273273
let t = NonSendable()
274274
await t.update()
275275
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
276-
// expected-tns-warning@-2 {{passing argument of non-sendable type 'NonSendable' from nonisolated context to main actor-isolated context at this call site could yield a race with accesses later in this function}}
276+
// expected-tns-warning@-2 {{transferring value of non-Sendable type 'NonSendable' from nonisolated context to main actor-isolated context; later accesses could race}}
277277

278278
_ = await t.x
279279
// expected-warning @-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}

test/Concurrency/transfernonsendable.swift

Lines changed: 61 additions & 61 deletions
Large diffs are not rendered by default.

test/Concurrency/transfernonsendable_asynclet.swift

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

test/Concurrency/transfernonsendable_cfg.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bb2:
4444
bb3:
4545
%transferKlass = function_ref @transferKlass : $@convention(thin) @async (@guaranteed NonSendableKlass) -> ()
4646
apply [caller_isolation=nonisolated] [callee_isolation=global_actor] %transferKlass(%klass) : $@convention(thin) @async (@guaranteed NonSendableKlass) -> ()
47-
// expected-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to global actor '<null>'-isolated context at this call site could yield a race with accesses later in this function}}
47+
// expected-warning @-1 {{transferring value of non-Sendable type 'NonSendableKlass' from nonisolated context to global actor '<null>'-isolated context; later accesses could race}}
4848
%useKlass = function_ref @useKlass : $@convention(thin) (@guaranteed NonSendableKlass) -> ()
4949
apply %useKlass(%klass) : $@convention(thin) (@guaranteed NonSendableKlass) -> ()
5050
// expected-note @-1 {{access here could race}}

test/Concurrency/transfernonsendable_global_actor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private class NonSendableLinkedListNode<T> { // expected-complete-note 3{{}}
8989
@GlobalActor func useGlobalActor5() async {
9090
let x = NonSendableLinkedListNode<Int>()
9191

92-
await transferToNonIsolated(x) // expected-tns-warning {{passing argument of non-sendable type 'NonSendableLinkedListNode<Int>' from global actor 'GlobalActor'-isolated context to nonisolated context at this call site could yield a race with accesses later in this function}}
92+
await transferToNonIsolated(x) // expected-tns-warning {{transferring value of non-Sendable type 'NonSendableLinkedListNode<Int>' from global actor 'GlobalActor'-isolated context to nonisolated context; later accesses could race}}
9393
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableLinkedListNode<Int>' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
9494

9595
useValue(x) // expected-tns-note {{access here could race}}
@@ -104,7 +104,7 @@ private struct StructContainingValue { // expected-complete-note 2{{}}
104104
var x = StructContainingValue()
105105
x = StructContainingValue()
106106

107-
await transferToNonIsolated(x) // expected-tns-warning {{passing argument of non-sendable type 'StructContainingValue' from global actor 'GlobalActor'-isolated context to nonisolated context at this call site could yield a race with accesses later in this function}}
107+
await transferToNonIsolated(x) // expected-tns-warning {{transferring value of non-Sendable type 'StructContainingValue' from global actor 'GlobalActor'-isolated context to nonisolated context; later accesses could race}}
108108
// expected-complete-warning @-1 {{passing argument of non-sendable type 'StructContainingValue' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
109109

110110
useValue(x) // expected-tns-note {{access here could race}}
@@ -124,7 +124,7 @@ private struct StructContainingValue { // expected-complete-note 2{{}}
124124
var x = (NonSendableLinkedList<Int>(), NonSendableLinkedList<Int>())
125125
x = (NonSendableLinkedList<Int>(), NonSendableLinkedList<Int>())
126126

127-
await transferToNonIsolated(x) // expected-tns-warning {{passing argument of non-sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' from global actor 'GlobalActor'-isolated context to nonisolated context at this call site could yield a race with accesses later in this function}}
127+
await transferToNonIsolated(x) // expected-tns-warning {{transferring value of non-Sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' from global actor 'GlobalActor'-isolated context to nonisolated context; later accesses could race}}
128128
// expected-complete-warning @-1 {{passing argument of non-sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
129129
// expected-complete-warning @-2 {{passing argument of non-sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' outside of global actor 'GlobalActor'-isolated context may introduce data races}}
130130

0 commit comments

Comments
 (0)