Skip to content

[region-isolation] Wordsmith "{access,use} here could race". #72544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsSIL.def
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ NOTE(sil_referencebinding_inout_binding_here, none,
//===----------------------------------------------------------------------===//

NOTE(regionbasedisolation_maybe_race, none,
"access here could race", ())
"use here could race", ())
ERROR(regionbasedisolation_unknown_pattern, none,
"pattern that the region based isolation checker does not understand how to check. Please file a bug",
())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func iterate(stream: AsyncStream<Int>) async {

// expected-region-isolation-warning @+3 {{transferring 'it' may cause a race}}
// expected-region-isolation-note @+2 {{transferring disconnected 'it' to nonisolated callee could cause races in between callee nonisolated and local main actor-isolated uses}}
// expected-region-isolation-note @+1 {{access here could race}}
// expected-region-isolation-note @+1 {{use here could race}}
while let element = await it.next() {
print(element)
}
Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/sendable_checking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func testNonSendableBaseArg() async {

_ = await t.x
// expected-warning @-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
// expected-tns-note@-2 {{access here could race}}
// expected-tns-note@-2 {{use here could race}}
}

@available(SwiftStdlib 5.1, *)
Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/transfernonsendable.sil
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bb0:
// expected-warning @-1 {{transferring value of non-Sendable type 'NonSendableKlass' from nonisolated context to global actor '<null>'-isolated context}}
%useIndirect = function_ref @useIndirect : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
apply %useIndirect<NonSendableKlass>(%1) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> ()
// expected-note @-1 {{access here could race}}
// expected-note @-1 {{use here could race}}

destroy_addr %1 : $*NonSendableKlass
dealloc_stack %1 : $*NonSendableKlass
Expand Down
124 changes: 62 additions & 62 deletions test/Concurrency/transfernonsendable.swift

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions test/Concurrency/transfernonsendable_asynclet.swift

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/Concurrency/transfernonsendable_cfg.sil
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bb3:
// expected-warning @-1 {{transferring value of non-Sendable type 'NonSendableKlass' from nonisolated context to global actor '<null>'-isolated context; later accesses could race}}
%useKlass = function_ref @useKlass : $@convention(thin) (@guaranteed NonSendableKlass) -> ()
apply %useKlass(%klass) : $@convention(thin) (@guaranteed NonSendableKlass) -> ()
// expected-note @-1 {{access here could race}}
// expected-note @-1 {{use here could race}}
destroy_value %klass : $NonSendableKlass
%9999 = tuple ()
return %9999 : $()
Expand Down
6 changes: 3 additions & 3 deletions test/Concurrency/transfernonsendable_global_actor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private class NonSendableLinkedListNode<T> { // expected-complete-note 3{{}}
// expected-tns-note @-1 {{transferring disconnected 'x' to nonisolated callee could cause races in between callee nonisolated and local global actor 'GlobalActor'-isolated uses}}
// expected-complete-warning @-2 {{passing argument of non-sendable type 'NonSendableLinkedListNode<Int>' outside of global actor 'GlobalActor'-isolated context may introduce data races}}

useValue(x) // expected-tns-note {{access here could race}}
useValue(x) // expected-tns-note {{use here could race}}
}

private struct StructContainingValue { // expected-complete-note 2{{}}
Expand All @@ -112,7 +112,7 @@ private struct StructContainingValue { // expected-complete-note 2{{}}
// expected-tns-note @-1 {{transferring disconnected 'x' to nonisolated callee could cause races in between callee nonisolated and local global actor 'GlobalActor'-isolated uses}}
// expected-complete-warning @-2 {{passing argument of non-sendable type 'StructContainingValue' outside of global actor 'GlobalActor'-isolated context may introduce data races}}

useValue(x) // expected-tns-note {{access here could race}}
useValue(x) // expected-tns-note {{use here could race}}
}

@GlobalActor func useGlobalActor7() async {
Expand All @@ -135,7 +135,7 @@ private struct StructContainingValue { // expected-complete-note 2{{}}
// 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}}
// expected-complete-warning @-3 {{passing argument of non-sendable type '(NonSendableLinkedList<Int>, NonSendableLinkedList<Int>)' outside of global actor 'GlobalActor'-isolated context may introduce data races}}

useValue(x) // expected-tns-note {{access here could race}}
useValue(x) // expected-tns-note {{use here could race}}
}

@GlobalActor func useGlobalActor9() async {
Expand Down
Loading