mirror of
https://github.com/apple/swift-nio
synced 2026-11-26 04:57:49 +00:00
Fix compiling on 6.1 (#3057)
Motivation: Swift 6.1 nightlies have added many new warnings and errors to NIO. This patch resolves all of them. Modifications: - Clean up missing imports - Move away from @_implementationOnly where necessary - Fix a few things where Sendable mismatches were present. Result: Clean compile again --------- Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
This commit is contained in:
1 parent
6fb31ea689
commit
96877aff7f
12 files changed
+26
-16
No files matched your search
@@ -131,7 +131,7 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
|
||||
self.scheduledTasks.removeFirst { $0.id == taskID }
|
||||
}
|
||||
|
||||
private func insertTask<ReturnType: Sendable>(
|
||||
private func insertTask<ReturnType>(
|
||||
taskID: UInt64,
|
||||
deadline: NIODeadline,
|
||||
promise: EventLoopPromise<ReturnType>,
|
||||
@@ -145,7 +145,8 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
|
||||
insertOrder: self.nextTaskNumber(),
|
||||
task: {
|
||||
do {
|
||||
promise.succeed(try task())
|
||||
// UnsafeUnchecked is acceptable because we know we're in the loop here.
|
||||
promise.assumeIsolatedUnsafeUnchecked().succeed(try task())
|
||||
} catch let err {
|
||||
promise.fail(err)
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
|
||||
/// - see: `EventLoop.scheduleTask(deadline:_:)`
|
||||
@discardableResult
|
||||
@preconcurrency
|
||||
public func scheduleTask<T: Sendable>(
|
||||
public func scheduleTask<T>(
|
||||
deadline: NIODeadline,
|
||||
_ task: @escaping @Sendable () throws -> T
|
||||
) -> Scheduled<T> {
|
||||
@@ -201,7 +202,7 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
|
||||
/// - see: `EventLoop.scheduleTask(in:_:)`
|
||||
@discardableResult
|
||||
@preconcurrency
|
||||
public func scheduleTask<T: Sendable>(in: TimeAmount, _ task: @escaping @Sendable () throws -> T) -> Scheduled<T> {
|
||||
public func scheduleTask<T>(in: TimeAmount, _ task: @escaping @Sendable () throws -> T) -> Scheduled<T> {
|
||||
self.scheduleTask(deadline: self.now + `in`, task)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user