From 8f3059e4cdeef09dae8765c75f48fd8b1ee096f9 Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 11 Sep 2025 17:05:53 -0700 Subject: [PATCH] Remove a retain-release pair from -count for bridged arrays --- stdlib/public/core/ContiguousArrayBuffer.swift | 1 + stdlib/public/core/SwiftNativeNSArray.swift | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift index 4f5daa3461f39..ab4ac715a80ef 100644 --- a/stdlib/public/core/ContiguousArrayBuffer.swift +++ b/stdlib/public/core/ContiguousArrayBuffer.swift @@ -141,6 +141,7 @@ internal final class _ContiguousArrayStorage< #if _runtime(_ObjC) + @_effects(releasenone) internal final override func withUnsafeBufferOfObjects( _ body: (UnsafeBufferPointer) throws -> R ) rethrows -> R { diff --git a/stdlib/public/core/SwiftNativeNSArray.swift b/stdlib/public/core/SwiftNativeNSArray.swift index ffbc557cda7ce..13d097c31f209 100644 --- a/stdlib/public/core/SwiftNativeNSArray.swift +++ b/stdlib/public/core/SwiftNativeNSArray.swift @@ -53,6 +53,7 @@ internal class __SwiftNativeNSArrayWithContiguousStorage deinit {} // Operate on our contiguous storage + @_effects(releasenone) internal func withUnsafeBufferOfObjects( _ body: (UnsafeBufferPointer) throws -> R ) rethrows -> R { @@ -379,6 +380,7 @@ extension __SwiftNativeNSArrayWithContiguousStorage { _destroyBridgedStorage(_heapBufferBridged) } + @_effects(releasenone) internal override func withUnsafeBufferOfObjects( _ body: (UnsafeBufferPointer) throws -> R ) rethrows -> R { @@ -438,7 +440,8 @@ extension __SwiftNativeNSArrayWithContiguousStorage { internal final class __SwiftDeferredStaticNSArray : __SwiftDeferredNSArray { - internal override func withUnsafeBufferOfObjects( + @_effects(releasenone) + final internal override func withUnsafeBufferOfObjects( _ body: (UnsafeBufferPointer) throws -> R ) rethrows -> R { while true { @@ -526,6 +529,7 @@ internal class __ContiguousArrayStorageBase } #if _runtime(_ObjC) + @_effects(releasenone) internal override func withUnsafeBufferOfObjects( _ body: (UnsafeBufferPointer) throws -> R ) rethrows -> R {