-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Enable Sendability for AsyncStream and AsyncThrowingStream #41713
Enable Sendability for AsyncStream and AsyncThrowingStream #41713
Conversation
|
@swift-ci please smoke test |
|
@swift-ci Please Test Source Compatibility |
|
@swift-ci please test linux |
| @@ -341,7 +340,7 @@ extension AsyncThrowingStream { | |||
| } | |||
| } | |||
|
|
|||
| func cancel() { | |||
| @Sendable func cancel() { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that one necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so since it is used in the termination which is sendable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM
|
@swift-ci please smoke test |
|
@swift-ci please test linux |
| } else { | ||
| unlock() | ||
| fatalError("attempt to await next() on more than one task") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phausler apologies for resurrecting this, but if you have a chance, could you help me understand why this check was removed? i assume it was not directly related to the conditional Sendable conformance since the same change wasn't made to the throwing variant, but maybe i'm overlooking something.
This makes AsyncStream and AsyncThrowingStream both conditionally Sendable when their Element is Sendable and removes the runtime assertion associated with that behavior.