diff --git a/Sources/NIOCore/AsyncChannel/AsyncChannel.swift b/Sources/NIOCore/AsyncChannel/AsyncChannel.swift index 4096b18f784..ee761680a61 100644 --- a/Sources/NIOCore/AsyncChannel/AsyncChannel.swift +++ b/Sources/NIOCore/AsyncChannel/AsyncChannel.swift @@ -324,6 +324,10 @@ public struct NIOAsyncChannel: Sendable { } #if compiler(>=6.0) + // Note: Whitespace changes are used to workaround compiler bug + // Remove when compiler version 5.10 is no longer supported. + // https://github.com/swiftlang/swift/issues/79285 + // swift-format-ignore /// Provides scoped access to the inbound and outbound side of the underlying ``Channel``. /// /// - Important: After this method returned the underlying ``Channel`` will be closed. @@ -331,11 +335,7 @@ public struct NIOAsyncChannel: Sendable { /// - Parameters: /// - actor: actor where this function should be isolated to /// - body: A closure that gets scoped access to the inbound and outbound. - public func executeThenClose( - isolation actor: isolated (any Actor)? = #isolation, - _ body: (_ inbound: NIOAsyncChannelInboundStream, _ outbound: NIOAsyncChannelOutboundWriter) - async throws -> sending Result - ) async throws -> sending Result { + public func executeThenClose(isolation actor: isolated (any Actor)? = #isolation, _ body: (_ inbound: NIOAsyncChannelInboundStream, _ outbound: NIOAsyncChannelOutboundWriter) async throws -> sending Result) async throws -> sending Result { let result: Result do { result = try await body(self._inbound, self._outbound) @@ -420,6 +420,10 @@ extension NIOAsyncChannel { } #if compiler(>=6.0) + // Note: Whitespace changes are used to workaround compiler bug + // Remove when compiler version 5.10 is no longer supported. + // https://github.com/swiftlang/swift/issues/79285 + // swift-format-ignore /// Provides scoped access to the inbound side of the underlying ``Channel``. /// /// - Important: After this method returned the underlying ``Channel`` will be closed. @@ -427,10 +431,7 @@ extension NIOAsyncChannel { /// - Parameters: /// - actor: actor where this function should be isolated to /// - body: A closure that gets scoped access to the inbound. - public func executeThenClose( - isolation actor: isolated (any Actor)? = #isolation, - _ body: (_ inbound: NIOAsyncChannelInboundStream) async throws -> sending Result - ) async throws -> sending Result where Outbound == Never { + public func executeThenClose(isolation actor: isolated (any Actor)? = #isolation, _ body: (_ inbound: NIOAsyncChannelInboundStream) async throws -> sending Result) async throws -> sending Result where Outbound == Never { let result: Result do { result = try await body(self._inbound) diff --git a/Sources/NIOCore/NIOLoopBound.swift b/Sources/NIOCore/NIOLoopBound.swift index d3eb66c1a04..ad216fd5c7f 100644 --- a/Sources/NIOCore/NIOLoopBound.swift +++ b/Sources/NIOCore/NIOLoopBound.swift @@ -140,16 +140,16 @@ public final class NIOLoopBoundBox: @unchecked Sendable { } #if compiler(>=6.0) + // Note: Whitespace changes are used to workaround compiler bug + // Remove when compiler version 5.10 is no longer supported. + // https://github.com/swiftlang/swift/issues/79285 + // swift-format-ignore /// Initialise a ``NIOLoopBoundBox`` by sending a value, validly callable off `eventLoop`. /// /// Contrary to ``init(_:eventLoop:)``, this method can be called off `eventLoop` because `value` is moved into the box and can no longer be accessed outside the box. /// So we don't need to protect `value` itself, we just need to protect the ``NIOLoopBoundBox`` against mutations which we do because the ``value`` /// accessors are checking that we're on `eventLoop`. - public static func makeBoxSendingValue( - _ value: sending Value, - as: Value.Type = Value.self, - eventLoop: EventLoop - ) -> NIOLoopBoundBox { + public static func makeBoxSendingValue(_ value: sending Value, as: Value.Type = Value.self, eventLoop: EventLoop) -> NIOLoopBoundBox { // Here, we -- possibly surprisingly -- do not precondition being on the EventLoop. This is okay for a few // reasons: // - This function takes its value as `sending` so we don't need to worry about somebody