Skip to content

Commit 7d0aec4

Browse files
committed
Return to some tests in transfernonsendable_closure_captures.swift back to their state so it passes in ToT.
I have a patch out of tree that fixes these tests so that the error is not emitted. But to make the overall change cherry-pickable, I decided to leave out that change. Once the main change lands, I will commit the other change and remove these diagnostics from the test file.
1 parent 0ce3729 commit 7d0aec4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/Concurrency/transfernonsendable_closure_captures.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ func testNoncopyableSendableStructWithEscapingMainActorAsync() {
127127
let x = NoncopyableStructSendable()
128128
let _ = {
129129
escapingAsyncUse { @MainActor in
130-
useValue(x)
130+
useValue(x) // expected-error {{sending 'x' risks causing data races}}
131+
// expected-note @-1 {{task-isolated 'x' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses}}
131132
}
132133
}
133134
}
@@ -252,7 +253,8 @@ func testNoncopyableSendableStructWithEscapingMainActorAsyncNormalCapture() {
252253
let x = NoncopyableStructSendable()
253254
let _ = { [x] in
254255
escapingAsyncUse { @MainActor in
255-
useValue(x)
256+
useValue(x) // expected-error {{sending 'x' risks causing data races}}
257+
// expected-note @-1 {{task-isolated 'x' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses}}
256258
}
257259
}
258260
}
@@ -262,7 +264,8 @@ func testMutableNoncopyableSendableStructWithEscapingMainActorAsyncNormalCapture
262264
x = NoncopyableStructSendable()
263265
let _ = { [x] in
264266
escapingAsyncUse { @MainActor in
265-
useValue(x)
267+
useValue(x) // expected-error {{sending 'x' risks causing data races}}
268+
// expected-note @-1 {{task-isolated 'x' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses}}
266269
}
267270
}
268271
}

0 commit comments

Comments
 (0)