Skip to content

Commit

Permalink
Fix Nightly Build to work with new Swift versions (#2288)
Browse files Browse the repository at this point in the history
Swift 5.8 has recently changed the name of the function assign to now be called update. Now, they call update like seen in this proposal:
https://github.com/apple/swift-evolution/blob/main/proposals/0370-pointer-family-initialization-improvements.md

Co-authored-by: Carolina Cassedy <ccassedy@apple.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
Co-authored-by: David Nadoba <d_nadoba@apple.com>
  • Loading branch information
4 people committed Oct 13, 2022
1 parent 1d4dc23 commit 788b759
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tests/NIOPosixTests/SocketAddressTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class SocketAddressTest: XCTestCase {
pathBytes.withUnsafeBufferPointer { srcPtr in
withUnsafeMutablePointer(to: &addr.sun_path) { dstPtr in
dstPtr.withMemoryRebound(to: UInt8.self, capacity: srcPtr.count) { dstPtr in
dstPtr.assign(from: srcPtr.baseAddress!, count: srcPtr.count)
dstPtr.update(from: srcPtr.baseAddress!, count: srcPtr.count)
}
}
}
Expand Down Expand Up @@ -571,3 +571,11 @@ class SocketAddressTest: XCTestCase {
}
}
}

#if swift(<5.8)
extension UnsafeMutablePointer {
func update(from source: UnsafePointer<Pointee>, count: Int) {
self.assign(from: source, count: count)
}
}
#endif

0 comments on commit 788b759

Please sign in to comment.