Remove redundant @unchecked Sendable annotations#201
Open
ianegordon wants to merge 1 commit intoswhitty:mainfrom
Open
Remove redundant @unchecked Sendable annotations#201ianegordon wants to merge 1 commit intoswhitty:mainfrom
ianegordon wants to merge 1 commit intoswhitty:mainfrom
Conversation
All four sites contained only Sendable types: - HTTPResponse.Payload: both cases hold Sendable values (HTTPBodySequence, any WSHandler). - WSMessage: associated values are Sendable. - HTTPRequestSequence: actors implicitly conform to Sendable per SE-0306. - OSLogLogger: os.Logger is @unchecked Sendable and the Logging protocol already requires Sendable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes
@unchecked Sendableannotations from four sites where the declaration is either redundant (the containing type is already Sendable by other means) or correct with a plainSendableconformance (all contained values are Sendable).HTTPResponse.swift:40public enum Payload: @unchecked Sendablepublic enum Payload: SendableWSMessage.swift:34public enum WSMessage: @unchecked Sendable, Hashablepublic enum WSMessage: Sendable, HashableHTTPConnection.swift:113actor HTTPRequestSequence<...>: AsyncSequence, AsyncIteratorProtocol, @unchecked Sendableactor HTTPRequestSequence<...>: AsyncSequence, AsyncIteratorProtocolLogging+OSLog.swift:36public struct OSLogLogger: Logging, @unchecked Sendablepublic struct OSLogLogger: LoggingRationale (primary-source verified)
HTTPResponse.Payload:.httpBody(HTTPBodySequence)—HTTPBodySequence: Sendable(HTTPBodySequence.swift:35)..webSocket(any WSHandler)—WSHandler: Sendable(WSHandler.swift:34).WSMessage: associated values areString,Data,WSCloseCode.WSCloseCode: Sendable(WSCloseCode.swift:34);String/Dataare Sendable.HTTPRequestSequence: per SE-0306, "every actor type implicitly conforms to the Sendable protocol." Explicit@unchecked Sendable(or even explicitSendable) on an actor is redundant.OSLogLogger:os.Loggeris declaredpublic struct Logger : @unchecked Swift.Sendablein the Xcode SDKos.swiftmoduleinterface, and theLoggingprotocol already requiresSendable(Logging.swift:32) — so both the@uncheckedand the explicitSendableconformance were redundant.Test plan
swift buildclean (no warnings, 5.16 s).swift test— 404 tests across 49 suites, all pass (1.13 s total).Scope
This is Group A of a broader
@unchecked Sendableaudit. The remaining 12 sites fall into two categories:Mutex-wrapped storage):HTTPBodySequence.Storage,AsyncStream+WSFrame.Iterator,WSFrameValidator.Validator. To be submitted separately.@uncheckedwith a justifying comment (Transferring,Mutexvariants,ConsumingAsyncSequence.SharedBuffer/State, retroactivesockaddr_*conformances). To be submitted separately.🤖 Generated with Claude Code