Skip to content

Commit 0f54d58

Browse files
authored
Fix compiler issues on 5.10 x86 Ubuntu Noble. (#3224)
Motivation: There's a known compiler issue on the 5.10 toolchain for x86 on Ubuntu Noble. This issue causes the compile to fail, even though the code is fine. We shouldn't allow that. Modifications: Shuffle the whitespace around to fix the issue. Suppress the linter issues. Result: Compiler is back. Resolves #3223.
1 parent 6e17bc9 commit 0f54d58

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

Sources/NIOCore/AsyncChannel/AsyncChannel.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,18 +324,18 @@ public struct NIOAsyncChannel<Inbound: Sendable, Outbound: Sendable>: Sendable {
324324
}
325325

326326
#if compiler(>=6.0)
327+
// Note: Whitespace changes are used to workaround compiler bug
328+
// Remove when compiler version 5.10 is no longer supported.
329+
// https://github.com/swiftlang/swift/issues/79285
330+
// swift-format-ignore
327331
/// Provides scoped access to the inbound and outbound side of the underlying ``Channel``.
328332
///
329333
/// - Important: After this method returned the underlying ``Channel`` will be closed.
330334
///
331335
/// - Parameters:
332336
/// - actor: actor where this function should be isolated to
333337
/// - body: A closure that gets scoped access to the inbound and outbound.
334-
public func executeThenClose<Result>(
335-
isolation actor: isolated (any Actor)? = #isolation,
336-
_ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>, _ outbound: NIOAsyncChannelOutboundWriter<Outbound>)
337-
async throws -> sending Result
338-
) async throws -> sending Result {
338+
public func executeThenClose<Result>(isolation actor: isolated (any Actor)? = #isolation, _ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>, _ outbound: NIOAsyncChannelOutboundWriter<Outbound>) async throws -> sending Result) async throws -> sending Result {
339339
let result: Result
340340
do {
341341
result = try await body(self._inbound, self._outbound)
@@ -420,17 +420,18 @@ extension NIOAsyncChannel {
420420
}
421421

422422
#if compiler(>=6.0)
423+
// Note: Whitespace changes are used to workaround compiler bug
424+
// Remove when compiler version 5.10 is no longer supported.
425+
// https://github.com/swiftlang/swift/issues/79285
426+
// swift-format-ignore
423427
/// Provides scoped access to the inbound side of the underlying ``Channel``.
424428
///
425429
/// - Important: After this method returned the underlying ``Channel`` will be closed.
426430
///
427431
/// - Parameters:
428432
/// - actor: actor where this function should be isolated to
429433
/// - body: A closure that gets scoped access to the inbound.
430-
public func executeThenClose<Result>(
431-
isolation actor: isolated (any Actor)? = #isolation,
432-
_ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>) async throws -> sending Result
433-
) async throws -> sending Result where Outbound == Never {
434+
public func executeThenClose<Result>(isolation actor: isolated (any Actor)? = #isolation, _ body: (_ inbound: NIOAsyncChannelInboundStream<Inbound>) async throws -> sending Result) async throws -> sending Result where Outbound == Never {
434435
let result: Result
435436
do {
436437
result = try await body(self._inbound)

Sources/NIOCore/NIOLoopBound.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ public final class NIOLoopBoundBox<Value>: @unchecked Sendable {
140140
}
141141

142142
#if compiler(>=6.0)
143+
// Note: Whitespace changes are used to workaround compiler bug
144+
// Remove when compiler version 5.10 is no longer supported.
145+
// https://github.com/swiftlang/swift/issues/79285
146+
// swift-format-ignore
143147
/// Initialise a ``NIOLoopBoundBox`` by sending a value, validly callable off `eventLoop`.
144148
///
145149
/// 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.
146150
/// So we don't need to protect `value` itself, we just need to protect the ``NIOLoopBoundBox`` against mutations which we do because the ``value``
147151
/// accessors are checking that we're on `eventLoop`.
148-
public static func makeBoxSendingValue(
149-
_ value: sending Value,
150-
as: Value.Type = Value.self,
151-
eventLoop: EventLoop
152-
) -> NIOLoopBoundBox<Value> {
152+
public static func makeBoxSendingValue(_ value: sending Value, as: Value.Type = Value.self, eventLoop: EventLoop) -> NIOLoopBoundBox<Value> {
153153
// Here, we -- possibly surprisingly -- do not precondition being on the EventLoop. This is okay for a few
154154
// reasons:
155155
// - This function takes its value as `sending` so we don't need to worry about somebody

0 commit comments

Comments
 (0)