Skip to content

Add Sendable conformance to various types #1334

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

Closed
wants to merge 1 commit into from

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Dec 17, 2021

Motivation:

Sendable conformance is used to indicate that a type is thread-safe.
Sendable checks are limited in 5.5 but will tighten in future Swift
versions.

Modifications:

  • Add Sendable conformance to a number of the new types added just for
    async/await
  • Add a GRPCSendable typealias to allow Sendable to be applied when
    it is available. This is used on the relevant types which existed
    before async/await support was added.

Result:

Wider Sendable conformance.

@glbrntt glbrntt requested a review from fabianfett December 17, 2021 12:06
@glbrntt glbrntt added the 🆕 semver/minor Adds new public API. label Dec 17, 2021
Comment on lines 162 to 163
Request: Sendable,
Response: Sendable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have an explicit Request and Response here? Cant we say

where Deserializer.Output == Sendable, Serializer.Input == Sendable

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, we can do that.

Copy link
Collaborator

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for one question this looks good to my eyes. However it might be good to get a second review on this as well.

Motivation:

Sendable conformance is used to indicate that a type is thread-safe.
Sendable checks are limited in 5.5 but will tighten in future Swift
versions.

Modifications:

- Add `Sendable` conformance to a number of the new types added just for
  async/await
- Add a `GRPCSendable` typealias to allow `Sendable` to be applied when
  it is available. This is used on the relevant types which existed
  before async/await support was added.

Result:

Wider Sendable conformance.
@glbrntt
Copy link
Collaborator Author

glbrntt commented Dec 20, 2021

Except for one question this looks good to my eyes. However it might be good to get a second review on this as well.

Okay, we can wait for @Lukasa to have a look -- no rush with this one tbh.

@glbrntt
Copy link
Collaborator Author

glbrntt commented Dec 20, 2021

Sadly the compiler is tripping over an assertion too: https://bugs.swift.org/browse/SR-15628

@glbrntt glbrntt requested a review from Lukasa December 20, 2021 16:16
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@glbrntt
Copy link
Collaborator Author

glbrntt commented Mar 29, 2022

Closing in favour of #1378

@glbrntt glbrntt closed this Mar 29, 2022
@glbrntt glbrntt deleted the gb-sendable branch March 29, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants