Fix compilation with Swift 5.5.0 and 5.5.1 (#2234)
This commit is contained in:
parent
ece5057615
commit
b4e0a274f7
|
@ -75,7 +75,7 @@ extension SocketAddressError {
|
||||||
public enum SocketAddress: CustomStringConvertible, NIOSendable {
|
public enum SocketAddress: CustomStringConvertible, NIOSendable {
|
||||||
|
|
||||||
/// A single IPv4 address for `SocketAddress`.
|
/// A single IPv4 address for `SocketAddress`.
|
||||||
public struct IPv4Address: NIOSendable {
|
public struct IPv4Address {
|
||||||
private let _storage: Box<(address: sockaddr_in, host: String)>
|
private let _storage: Box<(address: sockaddr_in, host: String)>
|
||||||
|
|
||||||
/// The libc socket address for an IPv4 address.
|
/// The libc socket address for an IPv4 address.
|
||||||
|
@ -90,7 +90,7 @@ public enum SocketAddress: CustomStringConvertible, NIOSendable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single IPv6 address for `SocketAddress`.
|
/// A single IPv6 address for `SocketAddress`.
|
||||||
public struct IPv6Address: NIOSendable {
|
public struct IPv6Address {
|
||||||
private let _storage: Box<(address: sockaddr_in6, host: String)>
|
private let _storage: Box<(address: sockaddr_in6, host: String)>
|
||||||
|
|
||||||
/// The libc socket address for an IPv6 address.
|
/// The libc socket address for an IPv6 address.
|
||||||
|
@ -560,6 +560,16 @@ extension SocketAddress: Equatable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if compiler(>=5.5.2)
|
||||||
|
extension SocketAddress.IPv4Address: Sendable {}
|
||||||
|
extension SocketAddress.IPv6Address: Sendable {}
|
||||||
|
#elseif compiler(>=5.5)
|
||||||
|
// Implicit conformance of tuples to Sendable interacts poorly with conditional conformance of Sendable in Swift <=5.5.1
|
||||||
|
// https://github.com/apple/swift/issues/57346
|
||||||
|
extension SocketAddress.IPv4Address: @unchecked Sendable {}
|
||||||
|
extension SocketAddress.IPv6Address: @unchecked Sendable {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/// We define an extension on `SocketAddress` that gives it an elementwise hashable conformance, using
|
/// We define an extension on `SocketAddress` that gives it an elementwise hashable conformance, using
|
||||||
/// only the elements defined on the structure in their man pages (excluding lengths).
|
/// only the elements defined on the structure in their man pages (excluding lengths).
|
||||||
extension SocketAddress: Hashable {
|
extension SocketAddress: Hashable {
|
||||||
|
|
|
@ -298,7 +298,7 @@ extension HTTPHeaders {
|
||||||
/// field when needed. It also supports recomposing headers to a maximally joined
|
/// field when needed. It also supports recomposing headers to a maximally joined
|
||||||
/// or split representation, such that header fields that are able to be repeated
|
/// or split representation, such that header fields that are able to be repeated
|
||||||
/// can be represented appropriately.
|
/// can be represented appropriately.
|
||||||
public struct HTTPHeaders: CustomStringConvertible, ExpressibleByDictionaryLiteral, NIOSendable {
|
public struct HTTPHeaders: CustomStringConvertible, ExpressibleByDictionaryLiteral {
|
||||||
@usableFromInline
|
@usableFromInline
|
||||||
internal var headers: [(String, String)]
|
internal var headers: [(String, String)]
|
||||||
internal var keepAliveState: KeepAliveState = .unknown
|
internal var keepAliveState: KeepAliveState = .unknown
|
||||||
|
@ -497,6 +497,14 @@ public struct HTTPHeaders: CustomStringConvertible, ExpressibleByDictionaryLiter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if compiler(>=5.5.2)
|
||||||
|
extension HTTPHeaders: Sendable {}
|
||||||
|
#elseif compiler(>=5.5)
|
||||||
|
// Implicit conformance of tuples to Sendable interacts poorly with conditional conformance of Sendable in Swift <=5.5.1
|
||||||
|
// https://github.com/apple/swift/issues/57346
|
||||||
|
extension HTTPHeaders: @unchecked Sendable {}
|
||||||
|
#endif
|
||||||
|
|
||||||
extension HTTPHeaders {
|
extension HTTPHeaders {
|
||||||
|
|
||||||
/// The total number of headers that can be contained without allocating new storage.
|
/// The total number of headers that can be contained without allocating new storage.
|
||||||
|
|
Loading…
Reference in New Issue