Skip to content

Commit f296529

Browse files
committed
[region-isolation] Change the main race error to be "transferring {could,may} cause a race"
As I was updating tests in the previous commit, I noticed that this would read better to me.
1 parent 1c193ca commit f296529

9 files changed

+80
-80
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ NOTE(regionbasedisolation_isolated_since_in_same_region_basename, none,
971971
//
972972

973973
ERROR(regionbasedisolation_named_transfer_yields_race, none,
974-
"transferring %0 could cause a race",
974+
"transferring %0 may cause a race",
975975
(Identifier))
976976
NOTE(regionbasedisolation_named_info_transfer_yields_race, none,
977977
"%0 is transferred from %1 caller to %2 callee. Later uses in caller could race with potential uses in callee",

test/Concurrency/experimental_feature_strictconcurrency.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ 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 @+3 {{transferring 'it' could cause a race}}
34+
// expected-region-isolation-warning @+3 {{transferring 'it' may cause a race}}
3535
// expected-region-isolation-note @+2 {{'it' is transferred from main actor-isolated caller to nonisolated callee. Later uses in caller could race with potential uses in callee}}
3636
// expected-region-isolation-note @+1 {{access here could race}}
3737
while let element = await it.next() {

test/Concurrency/isolated_captures.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class NotSendable {
3939
let ns = NotSendable(x: 0)
4040
MyActor.ns = ns
4141

42-
// expected-region-isolation-warning @+2 {{transferring 'ns' could cause a race}}
42+
// expected-region-isolation-warning @+2 {{transferring 'ns' may cause a race}}
4343
// expected-region-isolation-note @+1 {{transferring global actor 'MyActor'-isolated 'ns' to global actor 'YourActor'-isolated callee could cause races between global actor 'YourActor'-isolated and global actor 'MyActor'-isolated uses}}
4444
await { @YourActor in
4545
// expected-complete-warning@+1 {{capture of 'ns' with non-sendable type 'NotSendable' in an isolated closure; this is an error in Swift 6}}

test/Concurrency/sendable_checking.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ final class NonSendable {
251251
func call() async {
252252
await update()
253253
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
254-
// expected-tns-warning @-2 {{transferring 'self' could cause a race}}
254+
// expected-tns-warning @-2 {{transferring 'self' may cause a race}}
255255
// expected-tns-note @-3 {{transferring nonisolated 'self' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
256256

257257
await self.update()
258258
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
259-
// expected-tns-warning @-2 {{transferring 'self' could cause a race}}
259+
// expected-tns-warning @-2 {{transferring 'self' may cause a race}}
260260
// expected-tns-note @-3 {{transferring nonisolated 'self' to main actor-isolated callee could cause races between main actor-isolated and nonisolated uses}}
261261

262262
_ = await x
@@ -275,7 +275,7 @@ func testNonSendableBaseArg() async {
275275
let t = NonSendable() // expected-tns-note {{variable defined here}}
276276
await t.update()
277277
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
278-
// expected-tns-warning @-2 {{transferring 't' could cause a race}}
278+
// expected-tns-warning @-2 {{transferring 't' may cause a race}}
279279
// expected-tns-note @-3 {{'t' is transferred from nonisolated caller to main actor-isolated callee. Later uses in caller could race with potential uses in callee}}
280280

281281
_ = await t.x
@@ -295,13 +295,13 @@ func callNonisolatedAsyncClosure(
295295
) async {
296296
await g(ns)
297297
// expected-targeted-and-complete-warning @-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
298-
// expected-tns-warning @-2 {{transferring 'ns' could cause a race}}
298+
// expected-tns-warning @-2 {{transferring 'ns' may cause a race}}
299299
// expected-tns-note @-3 {{transferring main actor-isolated 'ns' to nonisolated callee could cause races between nonisolated and main actor-isolated uses}}
300300

301301
let f: (NonSendable) async -> () = globalSendable // okay
302302
await f(ns)
303303
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' outside of main actor-isolated context may introduce data races}}
304-
// expected-tns-warning @-2 {{transferring 'ns' could cause a race}}
304+
// expected-tns-warning @-2 {{transferring 'ns' may cause a race}}
305305
// expected-tns-note @-3 {{transferring main actor-isolated 'ns' to nonisolated callee could cause races between nonisolated and main actor-isolated uses}}
306306
}
307307

0 commit comments

Comments
 (0)