Skip to content

Commit 6b910c2

Browse files
committed
[region-isolation] Some more diagnostic wordsmithing.
rdar://127580781 (cherry picked from commit e4db879)
1 parent b7401e8 commit 6b910c2

21 files changed

+478
-478
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ NOTE(sil_referencebinding_inout_binding_here, none,
941941
//===----------------------------------------------------------------------===//
942942

943943
NOTE(regionbasedisolation_maybe_race, none,
944-
"risks concurrent access", ())
944+
"potential concurrent access", ())
945945
ERROR(regionbasedisolation_unknown_pattern, none,
946946
"pattern that the region based isolation checker does not understand how to check. Please file a bug",
947947
())
@@ -951,10 +951,10 @@ ERROR(regionbasedisolation_unknown_pattern, none,
951951
//
952952

953953
ERROR(regionbasedisolation_transfer_yields_race_no_isolation, none,
954-
"sending value of non-Sendable type %0; later accesses could race",
954+
"sending value of non-Sendable type %0 with later accesses risks causing data races",
955955
(Type))
956956
ERROR(regionbasedisolation_transfer_yields_race_with_isolation, none,
957-
"sending value of non-Sendable type %0 from %1 context to %2 context; later accesses could race",
957+
"sending value of non-Sendable type %0 with later accesses from %1 context to %2 context risks causing data races",
958958
(Type, ActorIsolation, ActorIsolation))
959959
ERROR(regionbasedisolation_isolated_capture_yields_race, none,
960960
"%1 closure captures value of non-Sendable type %0 from %2 context; later accesses to value could race",
@@ -963,7 +963,7 @@ ERROR(regionbasedisolation_transfer_yields_race_stronglytransferred_binding, non
963963
"value of non-Sendable type %0 accessed after being transferred; later accesses could race",
964964
(Type))
965965
ERROR(regionbasedisolation_arg_transferred, none,
966-
"sending %0 value of type %1 to %2 context; later accesses to value could race",
966+
"sending %0 value of type %1 with later accesses to %2 context risks causing data races",
967967
(StringRef, Type, ActorIsolation))
968968
ERROR(regionbasedisolation_arg_passed_to_strongly_transferred_param, none,
969969
"%0 value of type %1 passed as a strongly transferred parameter; later accesses could race",

test/ClangImporter/transferring.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ func funcTestTransferringResult() async {
2929
let y2 = returnUserDefinedFromGlobalFunction(x2)
3030
await transferToMain(x2) // expected-error {{sending 'x2' risks causing data races}}
3131
// expected-note @-1 {{sending 'x2' to main actor-isolated global function 'transferToMain' risks causing data races between main actor-isolated and local nonisolated uses}}
32-
useValue(y2) // expected-note {{risks concurrent access}}
32+
useValue(y2) // expected-note {{potential concurrent access}}
3333
}
3434

3535
func funcTestTransferringArg() async {
3636
let x = NonSendableCStruct()
3737
transferUserDefinedIntoGlobalFunction(x) // expected-error {{sending 'x' risks causing data races}}
3838
// expected-note @-1 {{'x' used after being passed as a transferring parameter}}
39-
useValue(x) // expected-note {{risks concurrent access}}
39+
useValue(x) // expected-note {{potential concurrent access}}
4040
}

test/ClangImporter/transferring_objc.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func methodTestTransferringArg() async {
2727
let s = NSObject()
2828
let _ = x.getResultWithTransferringArgument(s) // expected-error {{sending 's' risks causing data races}}
2929
// expected-note @-1 {{'s' used after being passed as a transferring parameter; Later uses could race}}
30-
useValue(s) // expected-note {{risks concurrent access}}
30+
useValue(s) // expected-note {{potential concurrent access}}
3131
}
3232

3333
// Make sure we just ignore the swift_attr if it is applied to something like a
@@ -47,12 +47,12 @@ func funcTestTransferringResult() async {
4747
let y2 = returnNSObjectFromGlobalFunction(x2)
4848
await transferToMain(x2) // expected-error {{sending 'x2' risks causing data races}}
4949
// expected-note @-1 {{sending 'x2' to main actor-isolated global function 'transferToMain' risks causing data races between main actor-isolated and local nonisolated uses}}
50-
useValue(y2) // expected-note {{risks concurrent access}}
50+
useValue(y2) // expected-note {{potential concurrent access}}
5151
}
5252

5353
func funcTestTransferringArg() async {
5454
let x = NSObject()
5555
transferNSObjectToGlobalFunction(x) // expected-error {{sending 'x' risks causing data races}}
5656
// expected-note @-1 {{'x' used after being passed as a transferring parameter; Later uses could race}}
57-
useValue(x) // expected-note {{risks concurrent access}}
57+
useValue(x) // expected-note {{potential concurrent access}}
5858
}

test/Concurrency/sendable_checking.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func testNonSendableBaseArg() async {
282282

283283
_ = await t.x
284284
// expected-warning @-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
285-
// expected-tns-note@-2 {{risks concurrent access}}
285+
// expected-tns-note@-2 {{potential concurrent access}}
286286
}
287287

288288
@available(SwiftStdlib 5.1, *)

test/Concurrency/transfernonsendable.sil

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bb0(%0 : $*{ var NonSendableKlass }):
112112

113113
%f = function_ref @transferIndirect : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
114114
apply [caller_isolation=nonisolated] [callee_isolation=global_actor] %f<NonSendableKlass>(%3) : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
115-
// expected-warning @-1 {{sending task-isolated value of type 'NonSendableKlass' to global actor '<null>'-isolated context}}
115+
// expected-warning @-1 {{}}
116116
destroy_value %1 : ${ var NonSendableKlass }
117117

118118
%9999 = tuple ()
@@ -157,10 +157,10 @@ bb0:
157157

158158
%f2 = function_ref @transferIndirect : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
159159
apply [caller_isolation=nonisolated] [callee_isolation=global_actor] %f2<NonSendableKlass>(%1) : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
160-
// expected-warning @-1 {{sending value of non-Sendable type 'NonSendableKlass' from nonisolated context to global actor '<null>'-isolated context}}
160+
// expected-warning @-1 {{}}
161161
%useIndirect = function_ref @useIndirect : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
162162
apply %useIndirect<NonSendableKlass>(%1) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
163-
// expected-note @-1 {{risks concurrent access}}
163+
// expected-note @-1 {{potential concurrent access}}
164164

165165
destroy_addr %1 : $*NonSendableKlass
166166
dealloc_stack %1 : $*NonSendableKlass
@@ -292,7 +292,7 @@ bb0(%0 : @guaranteed $MyActor):
292292
%3 = class_method %0 : $MyActor, #MyActor.klass!getter : (isolated MyActor) -> () -> NonSendableKlass, $@convention(method) (@sil_isolated @guaranteed MyActor) -> @owned NonSendableKlass
293293
%4 = apply %3(%0) : $@convention(method) (@sil_isolated @guaranteed MyActor) -> @owned NonSendableKlass
294294
%5 = class_method %4 : $NonSendableKlass, #NonSendableKlass.asyncCall : (NonSendableKlass) -> () async -> (), $@convention(method) @async (@guaranteed NonSendableKlass) -> ()
295-
%6 = apply [caller_isolation=nonisolated] [callee_isolation=actor_instance] %5(%4) : $@convention(method) @async (@guaranteed NonSendableKlass) -> () // expected-warning {{sending 'self'-isolated value of type 'NonSendableKlass' to actor-isolated context; later accesses to value could race}}
295+
%6 = apply [caller_isolation=nonisolated] [callee_isolation=actor_instance] %5(%4) : $@convention(method) @async (@guaranteed NonSendableKlass) -> () // expected-warning {{}}
296296
destroy_value %4 : $NonSendableKlass
297297
hop_to_executor %0 : $MyActor
298298
%9 = tuple ()
@@ -313,7 +313,7 @@ bb0(%0 : @guaranteed $MyActor):
313313
%11 = alloc_stack $NonSendableKlass
314314
%12 = store_borrow %6 to %11 : $*NonSendableKlass
315315
%13 = function_ref @transferIndirect : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> ()
316-
%14 = apply [caller_isolation=actor_instance] [callee_isolation=global_actor] %13<NonSendableKlass>(%12) : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> () // expected-warning {{sending 'self'-isolated value of type 'NonSendableKlass' to global actor '<null>'-isolated context}}
316+
%14 = apply [caller_isolation=actor_instance] [callee_isolation=global_actor] %13<NonSendableKlass>(%12) : $@convention(thin) @async <τ_0_0> (@in_guaranteed τ_0_0) -> () // expected-warning {{}}
317317
end_borrow %12 : $*NonSendableKlass
318318
dealloc_stack %11 : $*NonSendableKlass
319319
hop_to_executor %0 : $MyActor

0 commit comments

Comments
 (0)