From f7d5971e66f93c10d759c75174486f8ed2de77e1 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 11:25:24 +0200 Subject: [PATCH 01/13] Drop Swift 5.10 --- Package.swift | 118 ++++++++---------- Sources/NIOConcurrencyHelpers/NIOAtomic.swift | 13 -- Sources/NIOConcurrencyHelpers/atomics.swift | 13 -- .../NIOCore/AsyncChannel/AsyncChannel.swift | 2 - Sources/NIOCore/BSDSocketAPI.swift | 6 - Sources/NIOCore/ByteBuffer-aux.swift | 2 - Sources/NIOCore/NIOLoopBound.swift | 2 - .../NIOCrashTester/CrashTests+EventLoop.swift | 4 +- Sources/NIOPosix/Linux.swift | 5 - .../MultiThreadedEventLoopGroup.swift | 2 - .../PosixSingletons+ConcurrencyTakeOver.swift | 2 +- .../StructuredConcurrencyHelpers.swift | 34 ----- Sources/NIOPosix/System.swift | 15 --- Sources/NIOTestUtils/ManualTaskExecutor.swift | 4 - .../FileDescriptor+Syscalls.swift | 8 +- .../Internal/System Calls/Mocking.swift | 2 +- .../Internal/System Calls/Syscall.swift | 9 +- .../AsyncChannel/AsyncChannelTests.swift | 2 - .../AsyncSequences/NIOAsyncWriterTests.swift | 2 - Tests/NIOCoreTests/ByteBufferTest.swift | 14 --- Tests/NIOCoreTests/XCTest+AsyncAwait.swift | 2 +- Tests/NIOPosixTests/ChannelTests.swift | 2 +- Tests/NIOPosixTests/EventLoopTest.swift | 2 - Tests/NIOPosixTests/NIOLoopBoundTests.swift | 2 - .../NIOScheduledCallbackTests.swift | 8 +- Tests/NIOPosixTests/SerialExecutorTests.swift | 7 -- Tests/NIOPosixTests/ThreadTest.swift | 2 +- Tests/NIOPosixTests/XCTest+AsyncAwait.swift | 2 +- .../ManualTaskExecutorTest.swift | 4 - 29 files changed, 75 insertions(+), 215 deletions(-) diff --git a/Package.swift b/Package.swift index 7bad06be45..4d4d143881 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.10 +// swift-tools-version:6.0 //===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project @@ -25,21 +25,7 @@ let historicalNIOPosixDependencyRequired: [Platform] = [.macOS, .iOS, .tvOS, .wa let strictConcurrencyDevelopment = false -let strictConcurrencySettings: [SwiftSetting] = { - var initialSettings: [SwiftSetting] = [] - initialSettings.append(contentsOf: [ - .enableUpcomingFeature("StrictConcurrency"), - .enableUpcomingFeature("InferSendableFromCaptures"), - ]) - - if strictConcurrencyDevelopment { - // -warnings-as-errors here is a workaround so that IDE-based development can - // get tripped up on -require-explicit-sendable. - initialSettings.append(.unsafeFlags(["-require-explicit-sendable", "-warnings-as-errors"])) - } - - return initialSettings -}() +let swiftSettings: [SwiftSetting] = [] // This doesn't work when cross-compiling: the privacy manifest will be included in the Bundle and // Foundation will be linked. This is, however, strictly better than unconditionally adding the @@ -83,15 +69,15 @@ let package = Package( swiftCollections, swiftAtomics, ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "_NIODataStructures", - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "_NIOBase64", - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOEmbedded", @@ -102,7 +88,7 @@ let package = Package( swiftAtomics, swiftCollections, ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOPosix", @@ -118,7 +104,7 @@ let package = Package( ], exclude: includePrivacyManifest ? [] : ["PrivacyInfo.xcprivacy"], resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : [], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIO", @@ -127,7 +113,7 @@ let package = Package( "NIOEmbedded", "NIOPosix", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "_NIOConcurrency", @@ -135,7 +121,7 @@ let package = Package( .target(name: "NIO", condition: .when(platforms: historicalNIOPosixDependencyRequired)), "NIOCore", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOFoundationCompat", @@ -143,7 +129,7 @@ let package = Package( .target(name: "NIO", condition: .when(platforms: historicalNIOPosixDependencyRequired)), "NIOCore", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "CNIOAtomics", @@ -190,7 +176,7 @@ let package = Package( dependencies: [ "CNIOAtomics" ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOHTTP1", @@ -201,7 +187,7 @@ let package = Package( "CNIOLLHTTP", swiftCollections, ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOWebSocket", @@ -212,7 +198,7 @@ let package = Package( "CNIOSHA1", "_NIOBase64", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "CNIOLLHTTP", @@ -228,7 +214,7 @@ let package = Package( "NIOCore", swiftCollections, ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOTestUtils", @@ -239,7 +225,7 @@ let package = Package( "NIOHTTP1", swiftAtomics, ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOFS", @@ -255,7 +241,7 @@ let package = Package( path: "Sources/NIOFS", exclude: includePrivacyManifest ? [] : ["PrivacyInfo.xcprivacy"], resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : [], - swiftSettings: strictConcurrencySettings + [ + swiftSettings: swiftSettings + [ .define("ENABLE_MOCKING", .when(configuration: .debug)) ] ), @@ -266,7 +252,7 @@ let package = Package( "NIOFoundationCompat", ], path: "Sources/NIOFSFoundationCompat", - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( @@ -283,7 +269,7 @@ let package = Package( path: "Sources/_NIOFileSystem", exclude: includePrivacyManifest ? [] : ["PrivacyInfo.xcprivacy"], resources: includePrivacyManifest ? [.copy("PrivacyInfo.xcprivacy")] : [], - swiftSettings: strictConcurrencySettings + [ + swiftSettings: swiftSettings + [ .define("ENABLE_MOCKING", .when(configuration: .debug)) ] ), @@ -294,12 +280,12 @@ let package = Package( "NIOFoundationCompat", ], path: "Sources/_NIOFileSystemFoundationCompat", - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .target( name: "NIOFileSystem", dependencies: ["_NIOFileSystem"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), // MARK: - Examples @@ -311,7 +297,7 @@ let package = Package( "NIOCore", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOTCPEchoClient", @@ -320,7 +306,7 @@ let package = Package( "NIOCore", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOEchoServer", @@ -330,7 +316,7 @@ let package = Package( "NIOConcurrencyHelpers", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOEchoClient", @@ -340,7 +326,7 @@ let package = Package( "NIOConcurrencyHelpers", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOHTTP1Server", @@ -351,7 +337,7 @@ let package = Package( "NIOConcurrencyHelpers", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOHTTP1Client", @@ -362,7 +348,7 @@ let package = Package( "NIOConcurrencyHelpers", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOChatServer", @@ -372,7 +358,7 @@ let package = Package( "NIOConcurrencyHelpers", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOChatClient", @@ -382,7 +368,7 @@ let package = Package( "NIOConcurrencyHelpers", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOWebSocketServer", @@ -393,7 +379,7 @@ let package = Package( "NIOWebSocket", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOWebSocketClient", @@ -404,7 +390,7 @@ let package = Package( "NIOWebSocket", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOMulticastChat", @@ -412,7 +398,7 @@ let package = Package( "NIOPosix", "NIOCore", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOUDPEchoServer", @@ -421,7 +407,7 @@ let package = Package( "NIOCore", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOUDPEchoClient", @@ -430,7 +416,7 @@ let package = Package( "NIOCore", ], exclude: ["README.md"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOAsyncAwaitDemo", @@ -439,7 +425,7 @@ let package = Package( "NIOCore", "NIOHTTP1", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), // MARK: - Tests @@ -454,7 +440,7 @@ let package = Package( "NIOFoundationCompat", "NIOWebSocket", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .executableTarget( name: "NIOCrashTester", @@ -466,7 +452,7 @@ let package = Package( "NIOWebSocket", "NIOFoundationCompat", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOCoreTests", @@ -478,7 +464,7 @@ let package = Package( "NIOTestUtils", swiftAtomics, ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOEmbeddedTests", @@ -487,7 +473,7 @@ let package = Package( "NIOCore", "NIOEmbedded", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOPosixTests", @@ -502,7 +488,7 @@ let package = Package( "CNIODarwin", "NIOTLS", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOConcurrencyHelpersTests", @@ -510,17 +496,17 @@ let package = Package( "NIOConcurrencyHelpers", "NIOCore", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIODataStructuresTests", dependencies: ["_NIODataStructures"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOBase64Tests", dependencies: ["_NIOBase64"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOHTTP1Tests", @@ -532,7 +518,7 @@ let package = Package( "NIOFoundationCompat", "NIOTestUtils", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOTLSTests", @@ -543,7 +529,7 @@ let package = Package( "NIOFoundationCompat", "NIOTestUtils", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOWebSocketTests", @@ -552,7 +538,7 @@ let package = Package( "NIOEmbedded", "NIOWebSocket", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOTestUtilsTests", @@ -562,7 +548,7 @@ let package = Package( "NIOEmbedded", "NIOPosix", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOFoundationCompatTests", @@ -570,17 +556,17 @@ let package = Package( "NIOCore", "NIOFoundationCompat", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOTests", dependencies: ["NIO"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOSingletonsTests", dependencies: ["NIOCore", "NIOPosix"], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOFSTests", @@ -591,7 +577,7 @@ let package = Package( swiftCollections, swiftSystem, ], - swiftSettings: strictConcurrencySettings + [ + swiftSettings: swiftSettings + [ .define("ENABLE_MOCKING", .when(configuration: .debug)) ] ), @@ -609,7 +595,7 @@ let package = Package( // the build. "Test Data" ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), .testTarget( name: "NIOFSFoundationCompatTests", @@ -617,7 +603,7 @@ let package = Package( "NIOFS", "NIOFSFoundationCompat", ], - swiftSettings: strictConcurrencySettings + swiftSettings: swiftSettings ), ] ) diff --git a/Sources/NIOConcurrencyHelpers/NIOAtomic.swift b/Sources/NIOConcurrencyHelpers/NIOAtomic.swift index b67e6847d8..f2308ec929 100644 --- a/Sources/NIOConcurrencyHelpers/NIOAtomic.swift +++ b/Sources/NIOConcurrencyHelpers/NIOAtomic.swift @@ -19,7 +19,6 @@ import CNIOAtomics /// **Do not add conformance to this protocol for arbitrary types**. Only a small range /// of types have appropriate atomic operations supported by the CPU, and those types /// already have conformances implemented. -#if compiler(>=6.0) @preconcurrency public protocol NIOAtomicPrimitive { associatedtype AtomicWrapper @@ -35,18 +34,6 @@ public protocol NIOAtomicPrimitive { static var nio_atomic_load: @Sendable (UnsafeMutablePointer) -> Self { get } static var nio_atomic_store: @Sendable (UnsafeMutablePointer, Self) -> Void { get } } -#else -public protocol NIOAtomicPrimitive { - associatedtype AtomicWrapper - static var nio_atomic_create_with_existing_storage: (UnsafeMutablePointer, Self) -> Void { get } - static var nio_atomic_compare_and_exchange: (UnsafeMutablePointer, Self, Self) -> Bool { get } - static var nio_atomic_add: (UnsafeMutablePointer, Self) -> Self { get } - static var nio_atomic_sub: (UnsafeMutablePointer, Self) -> Self { get } - static var nio_atomic_exchange: (UnsafeMutablePointer, Self) -> Self { get } - static var nio_atomic_load: (UnsafeMutablePointer) -> Self { get } - static var nio_atomic_store: (UnsafeMutablePointer, Self) -> Void { get } -} -#endif extension Bool: NIOAtomicPrimitive { public typealias AtomicWrapper = catmc_nio_atomic__Bool diff --git a/Sources/NIOConcurrencyHelpers/atomics.swift b/Sources/NIOConcurrencyHelpers/atomics.swift index 75a2f90ee2..d472b083e8 100644 --- a/Sources/NIOConcurrencyHelpers/atomics.swift +++ b/Sources/NIOConcurrencyHelpers/atomics.swift @@ -297,7 +297,6 @@ extension Atomic: @unchecked Sendable where T: Sendable {} /// **Do not add conformance to this protocol for arbitrary types**. Only a small range /// of types have appropriate atomic operations supported by the CPU, and those types /// already have conformances implemented. -#if compiler(>=6.0) @preconcurrency public protocol AtomicPrimitive { static var atomic_create: @Sendable (Self) -> OpaquePointer { get } @@ -309,18 +308,6 @@ public protocol AtomicPrimitive { static var atomic_load: @Sendable (OpaquePointer) -> Self { get } static var atomic_store: @Sendable (OpaquePointer, Self) -> Void { get } } -#else -public protocol AtomicPrimitive { - static var atomic_create: (Self) -> OpaquePointer { get } - static var atomic_destroy: (OpaquePointer) -> Void { get } - static var atomic_compare_and_exchange: (OpaquePointer, Self, Self) -> Bool { get } - static var atomic_add: (OpaquePointer, Self) -> Self { get } - static var atomic_sub: (OpaquePointer, Self) -> Self { get } - static var atomic_exchange: (OpaquePointer, Self) -> Self { get } - static var atomic_load: (OpaquePointer) -> Self { get } - static var atomic_store: (OpaquePointer, Self) -> Void { get } -} -#endif extension Bool: AtomicPrimitive { public static let atomic_create = catmc_atomic__Bool_create diff --git a/Sources/NIOCore/AsyncChannel/AsyncChannel.swift b/Sources/NIOCore/AsyncChannel/AsyncChannel.swift index ee761680a6..cde8df1822 100644 --- a/Sources/NIOCore/AsyncChannel/AsyncChannel.swift +++ b/Sources/NIOCore/AsyncChannel/AsyncChannel.swift @@ -323,7 +323,6 @@ public struct NIOAsyncChannel: Sendable { return result } - #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 @@ -370,7 +369,6 @@ public struct NIOAsyncChannel: Sendable { return result } - #endif } // swift-format-ignore: AmbiguousTrailingClosureOverload diff --git a/Sources/NIOCore/BSDSocketAPI.swift b/Sources/NIOCore/BSDSocketAPI.swift index 34a9db9983..4b0972c755 100644 --- a/Sources/NIOCore/BSDSocketAPI.swift +++ b/Sources/NIOCore/BSDSocketAPI.swift @@ -102,15 +102,9 @@ private let sysInet_pton: @convention(c) (CInt, UnsafePointer?, UnsafeMut #endif #if os(Android) -#if compiler(>=6.0) @usableFromInline let IFF_BROADCAST: CUnsignedInt = numericCast(Android.IFF_BROADCAST.rawValue) @usableFromInline let IFF_POINTOPOINT: CUnsignedInt = numericCast(Android.IFF_POINTOPOINT.rawValue) @usableFromInline let IFF_MULTICAST: CUnsignedInt = numericCast(Android.IFF_MULTICAST.rawValue) -#else -@usableFromInline let IFF_BROADCAST: CUnsignedInt = numericCast(SwiftGlibc.IFF_BROADCAST.rawValue) -@usableFromInline let IFF_POINTOPOINT: CUnsignedInt = numericCast(SwiftGlibc.IFF_POINTOPOINT.rawValue) -@usableFromInline let IFF_MULTICAST: CUnsignedInt = numericCast(SwiftGlibc.IFF_MULTICAST.rawValue) -#endif #if arch(arm) @usableFromInline let SO_RCVTIMEO = SO_RCVTIMEO_OLD @usableFromInline let SO_TIMESTAMP = SO_TIMESTAMP_OLD diff --git a/Sources/NIOCore/ByteBuffer-aux.swift b/Sources/NIOCore/ByteBuffer-aux.swift index 39db01bc4f..60e57dd300 100644 --- a/Sources/NIOCore/ByteBuffer-aux.swift +++ b/Sources/NIOCore/ByteBuffer-aux.swift @@ -1003,7 +1003,6 @@ extension Optional where Wrapped == ByteBuffer { } } -#if compiler(>=6) extension ByteBuffer { /// Get the string at `index` from this `ByteBuffer` decoding using the UTF-8 encoding. Does not move the reader index. /// The selected bytes must be readable or else `nil` will be returned. @@ -1077,4 +1076,3 @@ extension ByteBuffer { try self.getUTF8ValidatedString(at: self.readerIndex, length: length) } } -#endif // compiler(>=6) diff --git a/Sources/NIOCore/NIOLoopBound.swift b/Sources/NIOCore/NIOLoopBound.swift index ad216fd5c7..6d5eba8f83 100644 --- a/Sources/NIOCore/NIOLoopBound.swift +++ b/Sources/NIOCore/NIOLoopBound.swift @@ -139,7 +139,6 @@ public final class NIOLoopBoundBox: @unchecked Sendable { .init(_value: value, uncheckedEventLoop: eventLoop) } - #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 @@ -159,7 +158,6 @@ public final class NIOLoopBoundBox: @unchecked Sendable { // - The only way to ever write (or read indeed) `self._value` is by proving to be inside the `EventLoop`. .init(_value: value, uncheckedEventLoop: eventLoop) } - #endif /// Access the `value` with the precondition that the code is running on `eventLoop`. /// diff --git a/Sources/NIOCrashTester/CrashTests+EventLoop.swift b/Sources/NIOCrashTester/CrashTests+EventLoop.swift index bd6d55207d..3487fcff02 100644 --- a/Sources/NIOCrashTester/CrashTests+EventLoop.swift +++ b/Sources/NIOCrashTester/CrashTests+EventLoop.swift @@ -180,7 +180,7 @@ struct EventLoopCrashTests { NIOSingletons.groupLoopCountSuggestion = -1 } - #if compiler(>=5.9) && swift(<6.2) // We only support Concurrency executor take-over on those Swift versions, as versions greater than that have not been properly tested. + #if swift(<6.2) // We only support Concurrency executor take-over on those Swift versions, as versions greater than that have not been properly tested. let testInstallingSingletonMTELGAsConcurrencyExecutorWorksButOnlyOnce = CrashTest( regex: #"Fatal error: Must be called only once"# ) { @@ -207,6 +207,6 @@ struct EventLoopCrashTests { // This should crash _ = NIOSingletons.unsafeTryInstallSingletonPosixEventLoopGroupAsConcurrencyGlobalExecutor() } - #endif // compiler(>=5.9) && swift(<6.2) + #endif // swift(<6.2) } #endif // !canImport(Darwin) || os(macOS) diff --git a/Sources/NIOPosix/Linux.swift b/Sources/NIOPosix/Linux.swift index f484768861..7069af121f 100644 --- a/Sources/NIOPosix/Linux.swift +++ b/Sources/NIOPosix/Linux.swift @@ -178,13 +178,8 @@ internal enum Epoll { internal enum Linux { #if os(Android) - #if compiler(>=6.0) static let SOCK_CLOEXEC = Android.SOCK_CLOEXEC static let SOCK_NONBLOCK = Android.SOCK_NONBLOCK - #else - static let SOCK_CLOEXEC = Glibc.SOCK_CLOEXEC - static let SOCK_NONBLOCK = Glibc.SOCK_NONBLOCK - #endif #elseif canImport(Musl) static let SOCK_CLOEXEC = Musl.SOCK_CLOEXEC static let SOCK_NONBLOCK = Musl.SOCK_NONBLOCK diff --git a/Sources/NIOPosix/MultiThreadedEventLoopGroup.swift b/Sources/NIOPosix/MultiThreadedEventLoopGroup.swift index d9dd2eab4b..63a0f55265 100644 --- a/Sources/NIOPosix/MultiThreadedEventLoopGroup.swift +++ b/Sources/NIOPosix/MultiThreadedEventLoopGroup.swift @@ -624,7 +624,6 @@ extension NIODeadline { } extension MultiThreadedEventLoopGroup { - #if compiler(>=6.0) /// Start & automatically shut down a new ``MultiThreadedEventLoopGroup``. /// /// This method allows to start & automatically dispose of a ``MultiThreadedEventLoopGroup`` following the principle of Structured Concurrency. @@ -660,5 +659,4 @@ extension MultiThreadedEventLoopGroup { } } } - #endif } diff --git a/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift b/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift index cc79c676d4..3ca4708e15 100644 --- a/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift +++ b/Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift @@ -44,7 +44,7 @@ extension NIOSingletons { return false #else // Guard between the minimum and maximum supported version for the hook - #if compiler(>=5.9) && compiler(<6.3) + #if compiler(<6.3) guard #available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) else { return false } diff --git a/Sources/NIOPosix/StructuredConcurrencyHelpers.swift b/Sources/NIOPosix/StructuredConcurrencyHelpers.swift index 07afda6f6a..a4333e6006 100644 --- a/Sources/NIOPosix/StructuredConcurrencyHelpers.swift +++ b/Sources/NIOPosix/StructuredConcurrencyHelpers.swift @@ -29,7 +29,6 @@ // Note: Whitespace changes are used to workaround compiler bug // https://github.com/swiftlang/swift/issues/79285 -#if compiler(>=6.0) @inlinable @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) internal func asyncDo( @@ -62,36 +61,3 @@ internal func asyncDo( }.value return result } -#else -@inlinable -@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) -internal func asyncDo( - _ body: () async throws -> R, - finally: @escaping @Sendable ((any Error)?) async throws -> Void -) async throws -> R { - let result: R - do { - result = try await body() - } catch { - // `body` failed, we need to invoke `finally` with the `error`. - - // This _looks_ unstructured but isn't really because we unconditionally always await the return. - // We need to have an uncancelled task here to assure this is actually running in case we hit a - // cancellation error. - try await Task { - try await finally(error) - }.value - throw error - } - - // `body` succeeded, we need to invoke `finally` with `nil` (no error). - - // This _looks_ unstructured but isn't really because we unconditionally always await the return. - // We need to have an uncancelled task here to assure this is actually running in case we hit a - // cancellation error. - try await Task { - try await finally(nil) - }.value - return result -} -#endif diff --git a/Sources/NIOPosix/System.swift b/Sources/NIOPosix/System.swift index 7c5b972012..576f75c674 100644 --- a/Sources/NIOPosix/System.swift +++ b/Sources/NIOPosix/System.swift @@ -44,15 +44,9 @@ internal typealias MMsgHdr = CNIOWindows_mmsghdr #if os(Android) let INADDR_ANY = UInt32(0) // #define INADDR_ANY ((unsigned long int) 0x00000000) -#if compiler(>=6.0) let IFF_BROADCAST: CUnsignedInt = numericCast(Android.IFF_BROADCAST.rawValue) let IFF_POINTOPOINT: CUnsignedInt = numericCast(Android.IFF_POINTOPOINT.rawValue) let IFF_MULTICAST: CUnsignedInt = numericCast(Android.IFF_MULTICAST.rawValue) -#else -let IFF_BROADCAST: CUnsignedInt = numericCast(SwiftGlibc.IFF_BROADCAST.rawValue) -let IFF_POINTOPOINT: CUnsignedInt = numericCast(SwiftGlibc.IFF_POINTOPOINT.rawValue) -let IFF_MULTICAST: CUnsignedInt = numericCast(SwiftGlibc.IFF_MULTICAST.rawValue) -#endif internal typealias in_port_t = UInt16 extension ipv6_mreq { // http://lkml.iu.edu/hypermail/linux/kernel/0106.1/0080.html init(ipv6mr_multiaddr: in6_addr, ipv6mr_interface: UInt32) { @@ -63,21 +57,12 @@ extension ipv6_mreq { // http://lkml.iu.edu/hypermail/linux/kernel/0106.1/0080. } } #if arch(arm) -#if compiler(>=6.0) let S_IFSOCK = UInt32(Android.S_IFSOCK) let S_IFMT = UInt32(Android.S_IFMT) let S_IFREG = UInt32(Android.S_IFREG) let S_IFDIR = UInt32(Android.S_IFDIR) let S_IFLNK = UInt32(Android.S_IFLNK) let S_IFBLK = UInt32(Android.S_IFBLK) -#else -let S_IFSOCK = UInt32(SwiftGlibc.S_IFSOCK) -let S_IFMT = UInt32(SwiftGlibc.S_IFMT) -let S_IFREG = UInt32(SwiftGlibc.S_IFREG) -let S_IFDIR = UInt32(SwiftGlibc.S_IFDIR) -let S_IFLNK = UInt32(SwiftGlibc.S_IFLNK) -let S_IFBLK = UInt32(SwiftGlibc.S_IFBLK) -#endif #endif #endif diff --git a/Sources/NIOTestUtils/ManualTaskExecutor.swift b/Sources/NIOTestUtils/ManualTaskExecutor.swift index c87ff324fe..95d4b2d67d 100644 --- a/Sources/NIOTestUtils/ManualTaskExecutor.swift +++ b/Sources/NIOTestUtils/ManualTaskExecutor.swift @@ -12,8 +12,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6) - import DequeModule import Synchronization @@ -162,5 +160,3 @@ package final class ManualTaskExecutor: TaskExecutor { } } } - -#endif // compiler(>=6) diff --git a/Sources/_NIOFileSystem/Internal/System Calls/FileDescriptor+Syscalls.swift b/Sources/_NIOFileSystem/Internal/System Calls/FileDescriptor+Syscalls.swift index 2941243999..724b48178f 100644 --- a/Sources/_NIOFileSystem/Internal/System Calls/FileDescriptor+Syscalls.swift +++ b/Sources/_NIOFileSystem/Internal/System Calls/FileDescriptor+Syscalls.swift @@ -207,9 +207,11 @@ extension FileDescriptor { } // Read and decode. - var buffer = [CChar](repeating: 0, count: capacity) + var buffer = [UInt8](repeating: 0, count: capacity) return buffer.withUnsafeMutableBufferPointer { pointer in - self.listExtendedAttributes(pointer) + pointer.withMemoryRebound(to: CChar.self) { buffer in + self.listExtendedAttributes(buffer) + } }.map { size in // The buffer contains null terminated C-strings. var attributes = [String]() @@ -217,7 +219,7 @@ extension FileDescriptor { while let index = slice.firstIndex(of: 0) { // TODO: can we do this more cheaply? let prefix = slice[...index] - attributes.append(String(cString: Array(prefix))) + attributes.append(String(decoding: Array(prefix), as: UTF8.self)) slice = slice.dropFirst(prefix.count) } diff --git a/Sources/_NIOFileSystem/Internal/System Calls/Mocking.swift b/Sources/_NIOFileSystem/Internal/System Calls/Mocking.swift index 50a48514b4..893a9e8e66 100644 --- a/Sources/_NIOFileSystem/Internal/System Calls/Mocking.swift +++ b/Sources/_NIOFileSystem/Internal/System Calls/Mocking.swift @@ -348,7 +348,7 @@ extension String { internal init?(_platformString platformString: UnsafePointer) { // Need to #if because CChar may be signed - self.init(validatingUTF8: platformString) + self.init(validatingCString: platformString) } internal init( diff --git a/Sources/_NIOFileSystem/Internal/System Calls/Syscall.swift b/Sources/_NIOFileSystem/Internal/System Calls/Syscall.swift index c3965c0f5d..1520586458 100644 --- a/Sources/_NIOFileSystem/Internal/System Calls/Syscall.swift +++ b/Sources/_NIOFileSystem/Internal/System Calls/Syscall.swift @@ -364,19 +364,22 @@ public enum Libc: Sendable { #if !os(Android) static func constr(_ name: CInt) -> Result { - var buffer = [CInterop.PlatformChar](repeating: 0, count: 128) + var buffer = [UInt8](repeating: 0, count: 128) repeat { let result = valueOrErrno(retryOnInterrupt: false) { buffer.withUnsafeMutableBufferPointer { pointer in - libc_confstr(name, pointer.baseAddress!, pointer.count) + pointer.withMemoryRebound(to: CInterop.PlatformChar.self) { pointer in + libc_confstr(name, pointer.baseAddress!, pointer.count) + } } } switch result { case let .success(length): + let nullTerminationIndex = buffer.firstIndex(of: 0) ?? buffer.endIndex if length <= buffer.count { - return .success(String(cString: buffer)) + return .success(String(decoding: buffer[..=6.0) func testExecuteThenCloseFromActor() async throws { final actor TestActor { func test() async throws { @@ -547,7 +546,6 @@ final class AsyncChannelTests: XCTestCase { let r = try await actor.test() XCTAssertEqual(r.someMutableState, 5) } - #endif } // This is unchecked Sendable since we only call this in the testing eventloop diff --git a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift index 97b601c73f..1ca77485e9 100644 --- a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift +++ b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift @@ -607,7 +607,6 @@ final class NIOAsyncWriterTests: XCTestCase { self.assert(suspendCallCount: 1, yieldCallCount: 1, terminateCallCount: 1) } - #if compiler(>=6) @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) func testWriterFinish_AndSuspendBufferedYield() async throws { try await withThrowingTaskGroup(of: Void.self) { group in @@ -654,7 +653,6 @@ final class NIOAsyncWriterTests: XCTestCase { } } } - #endif // compiler(>=6) func testWriterFinish_whenFinished() { // This tests just checks that finishing again is a no-op diff --git a/Tests/NIOCoreTests/ByteBufferTest.swift b/Tests/NIOCoreTests/ByteBufferTest.swift index 7885d463ce..ac3e3f809b 100644 --- a/Tests/NIOCoreTests/ByteBufferTest.swift +++ b/Tests/NIOCoreTests/ByteBufferTest.swift @@ -1316,7 +1316,6 @@ class ByteBufferTest: XCTestCase { } func testReadUTF8ValidatedString() throws { - #if compiler(>=6) guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'readUTF8ValidatedString' is only available in Swift 6 and later") } @@ -1327,13 +1326,9 @@ class ByteBufferTest: XCTestCase { XCTAssertEqual(expected, actual) XCTAssertEqual("", try buf.readUTF8ValidatedString(length: 0)) XCTAssertNil(try buf.readUTF8ValidatedString(length: 1)) - #else - throw XCTSkip("'readUTF8ValidatedString' is only available in Swift 6 and later") - #endif // compiler(>=6) } func testGetUTF8ValidatedString() throws { - #if compiler(>=6) guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'getUTF8ValidatedString' is only available in Swift 6 and later") } @@ -1342,13 +1337,9 @@ class ByteBufferTest: XCTestCase { buf.writeString(expected) let actual = try buf.getUTF8ValidatedString(at: 7, length: 7) XCTAssertEqual("goodbye", actual) - #else - throw XCTSkip("'getUTF8ValidatedString' is only available in Swift 6 and later") - #endif // compiler(>=6) } func testReadUTF8InvalidString() throws { - #if compiler(>=6) guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'readUTF8ValidatedString' is only available in Swift 6 and later") } @@ -1363,9 +1354,6 @@ class ByteBufferTest: XCTestCase { } } XCTAssertEqual(buf.readableBytes, 16) - #else - throw XCTSkip("'readUTF8ValidatedString' is only available in Swift 6 and later") - #endif // compiler(>=6) } func testSetIntegerBeyondCapacity() throws { @@ -4227,7 +4215,6 @@ extension ByteBufferTest { // MARK: - peekUTF8ValidatedString Tests (available in Swift 6+) - #if compiler(>=6) func testPeekUTF8ValidatedString_Normal() throws { guard #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) else { throw XCTSkip("'peekUTF8ValidatedString' is only available in Swift 6 and later") @@ -4267,7 +4254,6 @@ extension ByteBufferTest { ) XCTAssertEqual(buffer.readerIndex, 0, "peekUTF8ValidatedString() should not advance the reader index.") } - #endif // MARK: - peekDispatchData Tests (available when Dispatch is imported) diff --git a/Tests/NIOCoreTests/XCTest+AsyncAwait.swift b/Tests/NIOCoreTests/XCTest+AsyncAwait.swift index 9107a35518..0e7987d729 100644 --- a/Tests/NIOCoreTests/XCTest+AsyncAwait.swift +++ b/Tests/NIOCoreTests/XCTest+AsyncAwait.swift @@ -59,7 +59,7 @@ internal func XCTAssertThrowsError( @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) internal func XCTAssertNoThrow( _ expression: @autoclosure () async throws -> T, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) async { do { diff --git a/Tests/NIOPosixTests/ChannelTests.swift b/Tests/NIOPosixTests/ChannelTests.swift index baf916f4ea..7473a56f68 100644 --- a/Tests/NIOPosixTests/ChannelTests.swift +++ b/Tests/NIOPosixTests/ChannelTests.swift @@ -3293,7 +3293,7 @@ final class ChannelTests: XCTestCase { func _testTCP_NODELAYDefaultValue( value: Bool, _ socketAddress: SocketAddress, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) throws { let singleThreadedELG = MultiThreadedEventLoopGroup(numberOfThreads: 1) diff --git a/Tests/NIOPosixTests/EventLoopTest.swift b/Tests/NIOPosixTests/EventLoopTest.swift index 93a5a70043..71e26646ef 100644 --- a/Tests/NIOPosixTests/EventLoopTest.swift +++ b/Tests/NIOPosixTests/EventLoopTest.swift @@ -2015,7 +2015,6 @@ final class EventLoopTest: XCTestCase { } } - #if compiler(>=6.0) func testStructuredConcurrencyMTELGStartStop() async throws { let loops = try await MultiThreadedEventLoopGroup.withEventLoopGroup( numberOfThreads: 3 @@ -2069,7 +2068,6 @@ final class EventLoopTest: XCTestCase { } XCTAssertEqual("cool", actual) } - #endif func testRegressionSelectableEventLoopDeadlock() throws { let iterations = 1_000 diff --git a/Tests/NIOPosixTests/NIOLoopBoundTests.swift b/Tests/NIOPosixTests/NIOLoopBoundTests.swift index e50ccf79c4..2e6b51e4fc 100644 --- a/Tests/NIOPosixTests/NIOLoopBoundTests.swift +++ b/Tests/NIOPosixTests/NIOLoopBoundTests.swift @@ -75,7 +75,6 @@ final class NIOLoopBoundTests: XCTestCase { ) } - #if compiler(>=6.0) func testLoopBoundBoxCanBeInitialisedWithTakingValueOffLoopAndLaterSetToValue() { let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) defer { @@ -106,7 +105,6 @@ final class NIOLoopBoundTests: XCTestCase { }.wait() ) } - #endif func testInPlaceMutation() { var loopBound = NIOLoopBound(CoWValue(), eventLoop: loop) diff --git a/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift b/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift index 253aadcfdb..4caa11f622 100644 --- a/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift +++ b/Tests/NIOPosixTests/NIOScheduledCallbackTests.swift @@ -390,7 +390,7 @@ private final class MockScheduledCallbackHandler: NIOScheduledCallbackHandler, S self.cancelCount.wrappingIncrement(by: 1, ordering: .sequentiallyConsistent) } - func assert(callbackCount: Int, cancelCount: Int, file: StaticString = #file, line: UInt = #line) { + func assert(callbackCount: Int, cancelCount: Int, file: StaticString = #filePath, line: UInt = #line) { XCTAssertEqual( self.callbackCount.load(ordering: .sequentiallyConsistent), callbackCount, @@ -407,7 +407,7 @@ private final class MockScheduledCallbackHandler: NIOScheduledCallbackHandler, S ) } - func waitForCallback(timeout: TimeAmount, file: StaticString = #file, line: UInt = #line) async throws { + func waitForCallback(timeout: TimeAmount, file: StaticString = #filePath, line: UInt = #line) async throws { try await XCTWithTimeout(timeout, file: file, line: line) { await self.callbackStream.first { _ in true } } } } @@ -424,7 +424,7 @@ private final class NonSendableMockScheduledCallbackHandler: NIOScheduledCallbac self.cancelCount += 1 } - func assert(callbackCount: Int, cancelCount: Int, file: StaticString = #file, line: UInt = #line) { + func assert(callbackCount: Int, cancelCount: Int, file: StaticString = #filePath, line: UInt = #line) { XCTAssertEqual( self.callbackCount, callbackCount, @@ -457,7 +457,7 @@ private final class NonSendableMockScheduledCallbackHandler: NIOScheduledCallbac /// This function is probably a good balance of pragmatism and clarity. func XCTWithTimeout( _ timeout: TimeAmount, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line, operation: @escaping @Sendable () async throws -> Result ) async throws -> Result where Result: Sendable { diff --git a/Tests/NIOPosixTests/SerialExecutorTests.swift b/Tests/NIOPosixTests/SerialExecutorTests.swift index 3c69698d0f..b95bf28523 100644 --- a/Tests/NIOPosixTests/SerialExecutorTests.swift +++ b/Tests/NIOPosixTests/SerialExecutorTests.swift @@ -36,13 +36,11 @@ actor EventLoopBoundActor { XCTAssertFalse(loop.inEventLoop) } - #if compiler(>=6.0) nonisolated func assumeInLoop() -> Int { self.assumeIsolated { actor in actor.counter } } - #endif } @available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *) @@ -78,10 +76,6 @@ final class SerialExecutorTests: XCTestCase { } func testAssumeIsolation() async throws { - #if compiler(<6.0) - throw XCTSkip("Custom executors are only supported in 5.9") - #else - let el = self.group.next() let testActor = EventLoopBoundActor(loop: el) @@ -89,7 +83,6 @@ final class SerialExecutorTests: XCTestCase { testActor.assumeInLoop() }.get() XCTAssertEqual(result, 0) - #endif } override func setUp() { diff --git a/Tests/NIOPosixTests/ThreadTest.swift b/Tests/NIOPosixTests/ThreadTest.swift index 8f4fd72049..de9702f95f 100644 --- a/Tests/NIOPosixTests/ThreadTest.swift +++ b/Tests/NIOPosixTests/ThreadTest.swift @@ -428,7 +428,7 @@ class ThreadTest: XCTestCase { } // MARK: - Helpers - static func joinThread(_ thread: NIOLockedValueBox, file: StaticString = #file, line: UInt = #line) { + static func joinThread(_ thread: NIOLockedValueBox, file: StaticString = #filePath, line: UInt = #line) { if let thread = thread.withLockedValue({ $0 }) { thread.join() } else { diff --git a/Tests/NIOPosixTests/XCTest+AsyncAwait.swift b/Tests/NIOPosixTests/XCTest+AsyncAwait.swift index 3d58bffa3d..2c88cdb9bc 100644 --- a/Tests/NIOPosixTests/XCTest+AsyncAwait.swift +++ b/Tests/NIOPosixTests/XCTest+AsyncAwait.swift @@ -58,7 +58,7 @@ internal func XCTAssertThrowsError( @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) internal func XCTAssertNoThrow( _ expression: @autoclosure () async throws -> T, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) async { do { diff --git a/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift b/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift index 2b17234806..e451155ea7 100644 --- a/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift +++ b/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift @@ -12,8 +12,6 @@ // //===----------------------------------------------------------------------===// -#if compiler(>=6) - import NIOTestUtils import Synchronization import XCTest @@ -65,5 +63,3 @@ class ManualTaskExecutorTest: XCTestCase { } } } - -#endif // compiler(>=6) From 0dd900307190368ba0ac8875b440150971d13c40 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 11:30:22 +0200 Subject: [PATCH 02/13] Removed now unused variable --- Package.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Package.swift b/Package.swift index 4d4d143881..b12c0f8357 100644 --- a/Package.swift +++ b/Package.swift @@ -23,8 +23,6 @@ let swiftSystem: PackageDescription.Target.Dependency = .product(name: "SystemPa // compatibility with previous NIO versions. let historicalNIOPosixDependencyRequired: [Platform] = [.macOS, .iOS, .tvOS, .watchOS, .linux, .android] -let strictConcurrencyDevelopment = false - let swiftSettings: [SwiftSetting] = [] // This doesn't work when cross-compiling: the privacy manifest will be included in the Bundle and From fc715c71b5935044f32643ced385c021c0f72414 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 11:30:40 +0200 Subject: [PATCH 03/13] Disable 5.10 CI --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/cxx_interop.yml | 2 +- .github/workflows/release_builds.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 31605140f0..640a9051ad 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -17,7 +17,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: true + default: false linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." diff --git a/.github/workflows/cxx_interop.yml b/.github/workflows/cxx_interop.yml index 5076619e23..ff58bf8bdb 100644 --- a/.github/workflows/cxx_interop.yml +++ b/.github/workflows/cxx_interop.yml @@ -10,7 +10,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: true + default: false linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." diff --git a/.github/workflows/release_builds.yml b/.github/workflows/release_builds.yml index 6c605b5679..11c588b61d 100644 --- a/.github/workflows/release_builds.yml +++ b/.github/workflows/release_builds.yml @@ -6,7 +6,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: true + default: false linux_5_10_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index e9874b6e49..152f990e12 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -14,7 +14,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: true + default: false linux_5_10_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." From 592c94f441d660ec81e00f238e19e882ecff57a2 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 11:37:43 +0200 Subject: [PATCH 04/13] More deprecations fixed --- .../Internal/System Calls/FileDescriptor+Syscalls.swift | 8 +++++--- Sources/NIOFS/Internal/System Calls/Mocking.swift | 5 ----- Sources/NIOFS/Internal/System Calls/Syscall.swift | 9 ++++++--- Tests/NIOFSIntegrationTests/XCTestExtensions.swift | 8 ++++---- Tests/NIOFSTests/XCTestExtensions.swift | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift b/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift index 2941243999..c206161591 100644 --- a/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift +++ b/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift @@ -207,9 +207,11 @@ extension FileDescriptor { } // Read and decode. - var buffer = [CChar](repeating: 0, count: capacity) + var buffer = [UInt8](repeating: 0, count: capacity) return buffer.withUnsafeMutableBufferPointer { pointer in - self.listExtendedAttributes(pointer) + pointer.withMemoryRebound(to: CChar.self) { pointer in + self.listExtendedAttributes(pointer) + } }.map { size in // The buffer contains null terminated C-strings. var attributes = [String]() @@ -217,7 +219,7 @@ extension FileDescriptor { while let index = slice.firstIndex(of: 0) { // TODO: can we do this more cheaply? let prefix = slice[...index] - attributes.append(String(cString: Array(prefix))) + attributes.append(String(decoding: Array(prefix), as: Unicode.UTF8.self)) slice = slice.dropFirst(prefix.count) } diff --git a/Sources/NIOFS/Internal/System Calls/Mocking.swift b/Sources/NIOFS/Internal/System Calls/Mocking.swift index 50a48514b4..ed9db3f103 100644 --- a/Sources/NIOFS/Internal/System Calls/Mocking.swift +++ b/Sources/NIOFS/Internal/System Calls/Mocking.swift @@ -346,11 +346,6 @@ extension String { try withCString(body) } - internal init?(_platformString platformString: UnsafePointer) { - // Need to #if because CChar may be signed - self.init(validatingUTF8: platformString) - } - internal init( _errorCorrectingPlatformString platformString: UnsafePointer ) { diff --git a/Sources/NIOFS/Internal/System Calls/Syscall.swift b/Sources/NIOFS/Internal/System Calls/Syscall.swift index c3965c0f5d..7b672096bd 100644 --- a/Sources/NIOFS/Internal/System Calls/Syscall.swift +++ b/Sources/NIOFS/Internal/System Calls/Syscall.swift @@ -364,19 +364,22 @@ public enum Libc: Sendable { #if !os(Android) static func constr(_ name: CInt) -> Result { - var buffer = [CInterop.PlatformChar](repeating: 0, count: 128) + var buffer = [UInt8](repeating: 0, count: 128) repeat { let result = valueOrErrno(retryOnInterrupt: false) { buffer.withUnsafeMutableBufferPointer { pointer in - libc_confstr(name, pointer.baseAddress!, pointer.count) + pointer.withMemoryRebound(to: CInterop.PlatformChar.self) { buffer in + libc_confstr(name, buffer.baseAddress!, buffer.count) + } } } switch result { case let .success(length): if length <= buffer.count { - return .success(String(cString: buffer)) + let nullTerminationIndex = buffer.firstIndex(of: 0) ?? buffer.endIndex + return .success(String(decoding: buffer[..( - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line, expression: () async throws -> R, onError: (Error) -> Void = { _ in } @@ -32,7 +32,7 @@ func XCTAssertThrowsErrorAsync( func XCTAssertThrowsFileSystemError( _ expression: @autoclosure () throws -> R, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line, _ onError: (FileSystemError) -> Void = { _ in } ) { @@ -51,7 +51,7 @@ func XCTAssertThrowsFileSystemError( @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) func XCTAssertThrowsFileSystemErrorAsync( - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line, _ expression: () async throws -> R, onError: (FileSystemError) -> Void = { _ in } @@ -71,7 +71,7 @@ func XCTAssertThrowsFileSystemErrorAsync( func XCTAssertNoThrowAsync( _ expression: @autoclosure () async throws -> T, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) async { do { diff --git a/Tests/NIOFSTests/XCTestExtensions.swift b/Tests/NIOFSTests/XCTestExtensions.swift index 371c50b30f..3283e3d88d 100644 --- a/Tests/NIOFSTests/XCTestExtensions.swift +++ b/Tests/NIOFSTests/XCTestExtensions.swift @@ -17,7 +17,7 @@ import XCTest @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) func XCTAssertThrowsErrorAsync( - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line, expression: () async throws -> R, onError: (Error) -> Void = { _ in } @@ -32,7 +32,7 @@ func XCTAssertThrowsErrorAsync( func XCTAssertThrowsFileSystemError( _ expression: @autoclosure () throws -> R, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line, _ onError: (FileSystemError) -> Void = { _ in } ) { @@ -53,7 +53,7 @@ func XCTAssertSystemCallError( _ error: (any Error)?, name: String, errno: Errno, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) { guard let systemCallError = error as? FileSystemError.SystemCallError else { From f6ab36953e156d692da45d671f2bc13c19a03821 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 12:02:44 +0200 Subject: [PATCH 05/13] fix deprecation warning --- Tests/NIOPosixTests/TestUtils.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/NIOPosixTests/TestUtils.swift b/Tests/NIOPosixTests/TestUtils.swift index 1d17d194ec..453060cb39 100644 --- a/Tests/NIOPosixTests/TestUtils.swift +++ b/Tests/NIOPosixTests/TestUtils.swift @@ -32,7 +32,7 @@ extension System { static var supportsVsockLoopback: Bool { #if os(Linux) || os(Android) - guard let modules = try? String(contentsOf: URL(fileURLWithPath: "/proc/modules")) else { return false } + guard let modules = try? String(contentsOf: URL(fileURLWithPath: "/proc/modules"), encoding: .utf8) else { return false } return modules.split(separator: "\n").compactMap({ $0.split(separator: " ").first }).contains("vsock_loopback") #else return false From d1c88513caaafecf792038b998721702bb42377c Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 15:41:35 +0200 Subject: [PATCH 06/13] Fix macOS tests --- .../NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift | 4 ++-- .../Internal/System Calls/FileDescriptor+Syscalls.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift b/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift index c206161591..db13935c72 100644 --- a/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift +++ b/Sources/NIOFS/Internal/System Calls/FileDescriptor+Syscalls.swift @@ -218,9 +218,9 @@ extension FileDescriptor { var slice = buffer.prefix(size) while let index = slice.firstIndex(of: 0) { // TODO: can we do this more cheaply? - let prefix = slice[...index] + let prefix = slice[.. Date: Wed, 1 Oct 2025 15:57:40 +0200 Subject: [PATCH 07/13] Fix lint issue --- Sources/NIOTestUtils/ManualTaskExecutor.swift | 2 +- Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift | 2 +- Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/NIOTestUtils/ManualTaskExecutor.swift b/Sources/NIOTestUtils/ManualTaskExecutor.swift index 95d4b2d67d..645c12cdff 100644 --- a/Sources/NIOTestUtils/ManualTaskExecutor.swift +++ b/Sources/NIOTestUtils/ManualTaskExecutor.swift @@ -85,7 +85,7 @@ package func withManualTaskExecutor( /// - Returns: The value returned by `body`. @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) @inlinable -package func withManualTaskExecutor( +package func withManualTaskExecutors( body: (ManualTaskExecutor, ManualTaskExecutor) async throws(Failure) -> T ) async throws(Failure) -> T { let taskExecutor1 = ManualTaskExecutor() diff --git a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift index 1ca77485e9..e5ede68615 100644 --- a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift +++ b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift @@ -610,7 +610,7 @@ final class NIOAsyncWriterTests: XCTestCase { @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) func testWriterFinish_AndSuspendBufferedYield() async throws { try await withThrowingTaskGroup(of: Void.self) { group in - try await withManualTaskExecutor { taskExecutor1, taskExecutor2 in + try await withManualTaskExecutors { taskExecutor1, taskExecutor2 in self.sink.setWritability(to: false) self.delegate.didYieldHandler = { _ in diff --git a/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift b/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift index e451155ea7..51a58b34dd 100644 --- a/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift +++ b/Tests/NIOTestUtilsTests/ManualTaskExecutorTest.swift @@ -38,7 +38,7 @@ class ManualTaskExecutorTest: XCTestCase { @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) func testTwoManualTaskExecutors() async { await withDiscardingTaskGroup { group in - await withManualTaskExecutor { taskExecutor1, taskExecutor2 in + await withManualTaskExecutors { taskExecutor1, taskExecutor2 in let task1DidRun = Mutex(false) let task2DidRun = Mutex(false) From 54bb4377b5aa67ef191d60d8302565041eff58cf Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 16:00:19 +0200 Subject: [PATCH 08/13] swift-format --- Tests/NIOPosixTests/TestUtils.swift | 4 +++- Tests/NIOPosixTests/ThreadTest.swift | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Tests/NIOPosixTests/TestUtils.swift b/Tests/NIOPosixTests/TestUtils.swift index 453060cb39..a70dcfb659 100644 --- a/Tests/NIOPosixTests/TestUtils.swift +++ b/Tests/NIOPosixTests/TestUtils.swift @@ -32,7 +32,9 @@ extension System { static var supportsVsockLoopback: Bool { #if os(Linux) || os(Android) - guard let modules = try? String(contentsOf: URL(fileURLWithPath: "/proc/modules"), encoding: .utf8) else { return false } + guard let modules = try? String(contentsOf: URL(fileURLWithPath: "/proc/modules"), encoding: .utf8) else { + return false + } return modules.split(separator: "\n").compactMap({ $0.split(separator: " ").first }).contains("vsock_loopback") #else return false diff --git a/Tests/NIOPosixTests/ThreadTest.swift b/Tests/NIOPosixTests/ThreadTest.swift index de9702f95f..53333a3ce6 100644 --- a/Tests/NIOPosixTests/ThreadTest.swift +++ b/Tests/NIOPosixTests/ThreadTest.swift @@ -428,7 +428,8 @@ class ThreadTest: XCTestCase { } // MARK: - Helpers - static func joinThread(_ thread: NIOLockedValueBox, file: StaticString = #filePath, line: UInt = #line) { + static func joinThread(_ thread: NIOLockedValueBox, file: StaticString = #filePath, line: UInt = #line) + { if let thread = thread.withLockedValue({ $0 }) { thread.join() } else { From 25522deb4a86137730a1f8de65affa5891e8e80e Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 16:28:45 +0200 Subject: [PATCH 09/13] Revert "Disable 5.10 CI" This reverts commit fc715c71b5935044f32643ced385c021c0f72414. --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/cxx_interop.yml | 2 +- .github/workflows/release_builds.yml | 2 +- .github/workflows/unit_tests.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 640a9051ad..31605140f0 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -17,7 +17,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: false + default: true linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." diff --git a/.github/workflows/cxx_interop.yml b/.github/workflows/cxx_interop.yml index ff58bf8bdb..5076619e23 100644 --- a/.github/workflows/cxx_interop.yml +++ b/.github/workflows/cxx_interop.yml @@ -10,7 +10,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: false + default: true linux_6_0_enabled: type: boolean description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true." diff --git a/.github/workflows/release_builds.yml b/.github/workflows/release_builds.yml index 11c588b61d..6c605b5679 100644 --- a/.github/workflows/release_builds.yml +++ b/.github/workflows/release_builds.yml @@ -6,7 +6,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: false + default: true linux_5_10_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 152f990e12..e9874b6e49 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -14,7 +14,7 @@ on: linux_5_10_enabled: type: boolean description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." - default: false + default: true linux_5_10_arguments_override: type: string description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." From bf83c6ad13a6d7fa699a3b96d05c1f06a78ca311 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 16:34:00 +0200 Subject: [PATCH 10/13] Disable 5.10 tests --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5178bcce81..82f5145bfb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,7 @@ jobs: # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: + linux_5_10_enabled: false linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" @@ -23,6 +24,8 @@ jobs: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main + with: + linux_5_10_enabled: false benchmarks: name: Benchmarks @@ -30,6 +33,7 @@ jobs: uses: apple/swift-nio/.github/workflows/benchmarks.yml@main with: benchmark_package_path: "Benchmarks" + linux_5_10_enabled: false construct-integration-test-matrix: name: Construct integration test matrix @@ -84,3 +88,5 @@ jobs: release-builds: name: Release builds uses: apple/swift-nio/.github/workflows/release_builds.yml@main + with: + linux_5_10_enabled: false From 437aaacce7ba31e318b7943eda0f9142435bf5d7 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Wed, 1 Oct 2025 17:17:34 +0200 Subject: [PATCH 11/13] Revert "Disable 5.10 tests" This reverts commit bf83c6ad13a6d7fa699a3b96d05c1f06a78ca311. --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82f5145bfb..5178bcce81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,6 @@ jobs: # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: - linux_5_10_enabled: false linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" @@ -24,8 +23,6 @@ jobs: name: Cxx interop # Workaround https://github.com/nektos/act/issues/1875 uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main - with: - linux_5_10_enabled: false benchmarks: name: Benchmarks @@ -33,7 +30,6 @@ jobs: uses: apple/swift-nio/.github/workflows/benchmarks.yml@main with: benchmark_package_path: "Benchmarks" - linux_5_10_enabled: false construct-integration-test-matrix: name: Construct integration test matrix @@ -88,5 +84,3 @@ jobs: release-builds: name: Release builds uses: apple/swift-nio/.github/workflows/release_builds.yml@main - with: - linux_5_10_enabled: false From 0d14246d4cf56a7f71c89793b362adf333155725 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Thu, 2 Oct 2025 12:21:35 +0200 Subject: [PATCH 12/13] Fix format --- .../NIOCore/AsyncChannel/AsyncChannel.swift | 21 ++++++++----------- Sources/NIOCore/NIOLoopBound.swift | 10 ++++----- .../StructuredConcurrencyHelpers.swift | 9 +++----- Sources/NIOPosix/Thread.swift | 1 - 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Sources/NIOCore/AsyncChannel/AsyncChannel.swift b/Sources/NIOCore/AsyncChannel/AsyncChannel.swift index cde8df1822..050b72b7bf 100644 --- a/Sources/NIOCore/AsyncChannel/AsyncChannel.swift +++ b/Sources/NIOCore/AsyncChannel/AsyncChannel.swift @@ -323,10 +323,6 @@ public struct NIOAsyncChannel: Sendable { return result } - // 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. @@ -334,7 +330,11 @@ 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) @@ -417,11 +417,6 @@ extension NIOAsyncChannel { return result } - #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. @@ -429,7 +424,10 @@ 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) @@ -464,7 +462,6 @@ extension NIOAsyncChannel { return result } - #endif } extension Channel { diff --git a/Sources/NIOCore/NIOLoopBound.swift b/Sources/NIOCore/NIOLoopBound.swift index 6d5eba8f83..9f843b834b 100644 --- a/Sources/NIOCore/NIOLoopBound.swift +++ b/Sources/NIOCore/NIOLoopBound.swift @@ -139,16 +139,16 @@ public final class NIOLoopBoundBox: @unchecked Sendable { .init(_value: value, uncheckedEventLoop: eventLoop) } - // 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 diff --git a/Sources/NIOPosix/StructuredConcurrencyHelpers.swift b/Sources/NIOPosix/StructuredConcurrencyHelpers.swift index a4333e6006..012ef95647 100644 --- a/Sources/NIOPosix/StructuredConcurrencyHelpers.swift +++ b/Sources/NIOPosix/StructuredConcurrencyHelpers.swift @@ -25,17 +25,14 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// swift-format-ignore -// Note: Whitespace changes are used to workaround compiler bug -// https://github.com/swiftlang/swift/issues/79285 @inlinable @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) internal func asyncDo( isolation: isolated (any Actor)? = #isolation, - // DO NOT FIX THE WHITESPACE IN THE NEXT LINE UNTIL 5.10 IS UNSUPPORTED - // https://github.com/swiftlang/swift/issues/79285 - _ body: () async throws -> sending R, finally: sending @escaping ((any Error)?) async throws -> Void) async throws -> sending R { + _ body: () async throws -> sending R, + finally: sending @escaping ((any Error)?) async throws -> Void +) async throws -> sending R { let result: R do { result = try await body() diff --git a/Sources/NIOPosix/Thread.swift b/Sources/NIOPosix/Thread.swift index 9ed6165999..b730aba1b2 100644 --- a/Sources/NIOPosix/Thread.swift +++ b/Sources/NIOPosix/Thread.swift @@ -44,7 +44,6 @@ protocol ThreadOps { /// A Thread that executes some runnable block. /// /// All methods exposed are thread-safe. -// swift-format-ignore @usableFromInline final class NIOThread: Sendable { internal typealias ThreadBoxValue = (body: (NIOThread) -> Void, name: String?) From 7a874fe8f93a48f7b5faeb2a67c1a4704ae321fe Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Thu, 2 Oct 2025 12:21:45 +0200 Subject: [PATCH 13/13] Update README versions --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76083ea700..5e858fd9bb 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,8 @@ SwiftNIO | Minimum Swift Version `2.60.0 ..< 2.65.0` | 5.7 `2.65.0 ..< 2.76.0` | 5.8 `2.76.0 ..< 2.83.0` | 5.9 -`2.83.0 ...` | 5.10 +`2.83.0 ..< 2.87.0` | 5.10 +`2.87.0 ... ` | 6.0 ### SwiftNIO 1 SwiftNIO 1 is considered end of life - it is strongly recommended that you move to a newer version. The Core NIO team does not actively work on this version. No new features will be added to this version but PRs which fix bugs or security vulnerabilities will be accepted until the end of May 2022.