Skip to content

Make the value-typed protocol options Sendable - #213

Open
rnro wants to merge 2 commits into
apple:mainfrom
rnro:value-typed-options-sendable
Open

rnro wants to merge 2 commits into
apple:mainfrom
rnro:value-typed-options-sendable

Conversation

@rnro

@rnro rnro commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

This is part of the larget aim to make Parameters Sendable. Parameters can only be Sendable once everything its protocol stack holds is, starting with the per-protocol options. Most of the value-typed options only lacked the declaration. CustomLinkOptions and BridgeOptions store handlers that the stack calls from its own context, so those handlers are now @Sendable, as are the copies CustomLinkInstance keeps. SwiftTLSOptions is not yet Sendable, so SwiftTLS is imported with @preconcurrency until swift-tls declares the conformance, which leaves one warning until then.

Requiring @Sendable handlers is a source break for callers that pass non-Sendable closures to the CustomLink or BridgeDatagramProtocol handlers; the three tests that did are updated. QUICTransfer, QUICHandshake, and QUICStreamLoad, built with logging compiled out, show every difference within 1%.

This is part of the larget aim to make `Parameters` `Sendable`.
`Parameters` can only be `Sendable` once everything its protocol stack holds is,
starting with the per-protocol options. Most of the value-typed options only
lacked the declaration. `CustomLinkOptions` and `BridgeOptions` store handlers
that the stack calls from its own context, so those handlers are now
`@Sendable`, as are the copies `CustomLinkInstance` keeps. `SwiftTLSOptions` is
not yet `Sendable`, so `SwiftTLS` is imported with `@preconcurrency` until
swift-tls declares the conformance, which leaves one warning until then.

Requiring `@Sendable` handlers is a source break for callers that pass
non-`Sendable` closures to the `CustomLink` or `BridgeDatagramProtocol`
handlers; the three tests that did are updated. `QUICTransfer`,
`QUICHandshake`, and `QUICStreamLoad`, built with logging compiled out, show
every difference within 1%.
@rnro
rnro requested review from ekinnear and tfpauly as code owners October 4, 2026 01:03
@rnro rnro added the ⚠️ semver/major Breaks existing public API. label Oct 4, 2026
@rnro
rnro requested a review from agnosticdev as a code owner October 4, 2026 01:03
…FTTLS`

Under `EXPORT_SWIFTTLS` the options store a `SwiftTLSOptions`, which is
not `Sendable`. Importing `SwiftTLS` with `@preconcurrency` only
downgraded the resulting diagnostic to a warning, and CI builds with
`-warnings-as-errors`, so every build failed.

* Moved the `Sendable` conformance into an extension that only exists
  without `EXPORT_SWIFTTLS`
* Dropped the `@preconcurrency` on the `SwiftTLS` imports

Under `EXPORT_SWIFTTLS` the options are not `Sendable` until swift-tls
declares the conformance for `SwiftTLSOptions`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ semver/major Breaks existing public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant