From 788b759d0b3e1ca673c9ca405d108372b3344264 Mon Sep 17 00:00:00 2001 From: carolinacass <67160898+carolinacass@users.noreply.github.com> Date: Thu, 13 Oct 2022 14:29:40 +0100 Subject: [PATCH] Fix Nightly Build to work with new Swift versions (#2288) 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 Co-authored-by: Cory Benfield Co-authored-by: David Nadoba --- Tests/NIOPosixTests/SocketAddressTest.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tests/NIOPosixTests/SocketAddressTest.swift b/Tests/NIOPosixTests/SocketAddressTest.swift index 514b52060..843759422 100644 --- a/Tests/NIOPosixTests/SocketAddressTest.swift +++ b/Tests/NIOPosixTests/SocketAddressTest.swift @@ -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) } } } @@ -571,3 +571,11 @@ class SocketAddressTest: XCTestCase { } } } + +#if swift(<5.8) +extension UnsafeMutablePointer { + func update(from source: UnsafePointer, count: Int) { + self.assign(from: source, count: count) + } +} +#endif