From cfcab2a2d3a7db791f5e072858daf920d5c364e3 Mon Sep 17 00:00:00 2001 From: mapierce Date: Tue, 27 Aug 2024 13:29:33 +0100 Subject: [PATCH] Fixes issue around mutable capture of 'inout' parameter 'buffer' is not allowed in concurrently-executing code --- SourceryRuntime/Sources/Common/Array+Parallel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/SourceryRuntime/Sources/Common/Array+Parallel.swift b/SourceryRuntime/Sources/Common/Array+Parallel.swift index 02bc31208..a7183bc09 100644 --- a/SourceryRuntime/Sources/Common/Array+Parallel.swift +++ b/SourceryRuntime/Sources/Common/Array+Parallel.swift @@ -17,6 +17,7 @@ public extension Array { func parallelMap(transform: (Element) -> T) -> [T] { var result = ContiguousArray(repeating: nil, count: count) return result.withUnsafeMutableBufferPointer { buffer in + nonisolated(unsafe) let buffer = buffer DispatchQueue.concurrentPerform(iterations: buffer.count) { idx in buffer[idx] = transform(self[idx]) }