Skip to content

Drop @unchecked from compiler-checkable Sendable conformances - #947

Merged
Lukasa merged 1 commit into
swift-server:mainfrom
d-date:remove-unchecked-sendable
Oct 30, 2026
Merged

Lukasa merged 1 commit into
swift-server:mainfrom
d-date:remove-unchecked-sendable

Conversation

@d-date

@d-date d-date commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Motivation

Two Sendable conformances are marked @unchecked even though the compiler can verify them:

  • SingleIteratorPrecondition stores only let base: Base and let didCreateIterator: ManagedAtomic<Bool>. With the existing where Base: Sendable constraint, every stored property is Sendable.
  • HTTPHeadersInjector has no stored properties.

Keeping @unchecked here means the compiler would not catch a future change that breaks sendability.

Modifications

  • Replace @unchecked Sendable with Sendable on both types.

Result

No behavior change; the conformances are now checked by the compiler.

Verified locally on macOS (Swift 6.4.2): swift build --build-tests -Xswiftc -strict-concurrency=complete produces no new diagnostics. swift test passes except testConnectTimeout (x2), which also fails on unmodified main in my environment (connection reset instead of timeout) and is unrelated to this change.

SingleIteratorPrecondition only stores the base sequence and a
ManagedAtomic, and HTTPHeadersInjector has no stored properties, so the
compiler can verify both conformances without @unchecked.
@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Oct 30, 2026

@Lukasa Lukasa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this!

@Lukasa
Lukasa merged commit d2dfb39 into swift-server:main Oct 30, 2026
36 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants