diff --git a/Sources/HTTPTypes/HTTPFields.swift b/Sources/HTTPTypes/HTTPFields.swift index df8a141..c368dc9 100644 --- a/Sources/HTTPTypes/HTTPFields.swift +++ b/Sources/HTTPTypes/HTTPFields.swift @@ -32,7 +32,7 @@ public struct HTTPFields: Sendable, Hashable { required init() { } - func withLock(_ body: () throws -> Result) rethrows -> Result { + func withLock(_ body: () throws -> sending Result) rethrows -> sending Result { fatalError() } @@ -114,7 +114,7 @@ public struct HTTPFields: Sendable, Hashable { private final class _StorageWithMutex: _Storage, @unchecked Sendable { let mutex = Mutex(()) - override func withLock(_ body: () throws -> Result) rethrows -> Result { + override func withLock(_ body: () throws -> sending Result) rethrows -> sending Result { try self.mutex.withLock { _ in try body() } @@ -125,7 +125,7 @@ public struct HTTPFields: Sendable, Hashable { private final class _StorageWithNIOLock: _Storage, @unchecked Sendable { let lock = LockStorage.create(value: ()) - override func withLock(_ body: () throws -> Result) rethrows -> Result { + override func withLock(_ body: () throws -> sending Result) rethrows -> sending Result { try self.lock.withLockedValue { _ in try body() }