Skip to content

Conversation

@gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Dec 12, 2025

This ensures that in cases like the following:

func testNoncopyableNonsendableStructWithNonescapingMainActorAsync() {
  let x = NoncopyableStructNonsendable()    <=========
  let _ = {
    nonescapingAsyncClosure { @MainActor in
      useValueNoncopyable(x) // expected-warning {{sending 'x' risks causing data races}}
      // 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}}
    }
  }
}

We emit the diagnostic on the use instead of the <=====.

rdar://166347485

…alue and store_borrow temporaries.

This ensures that in cases like the following:

+func testNoncopyableNonsendableStructWithNonescapingMainActorAsync() {
+  let x = NoncopyableStructNonsendable()    <=========
+  let _ = {
+    nonescapingAsyncClosure { @mainactor in
+      useValueNoncopyable(x) // expected-warning {{sending 'x' risks causing data races}}
+      // 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}}
+    }
+  }
+}

We emit the diagnostic on the use instead of the <=====.

rdar://166347485
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm enabled auto-merge December 12, 2025 02:45
@gottesmm gottesmm merged commit 22d1825 into swiftlang:main Dec 12, 2025
3 checks passed
@gottesmm gottesmm deleted the pr-c29e9002447c10b77a408ede1f7b7e42c5034dbf branch December 13, 2025 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant