From 259b4d52c216a44bf08f9213a75bf41da35fcbeb Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 29 Jun 2026 16:15:00 +0530 Subject: [PATCH] Fix @inlinable deinit incompatibility with library evolution The `Storage` classes in HashTreeCollections and SortedCollections mark their `deinit` as `@inlinable` but lack `@_fixed_layout`. Under library evolution (BUILD_LIBRARY_FOR_DISTRIBUTION=YES), Swift 6.2+ rejects this with "deinitializer can only be '@inlinable' if the class is '@_fixed_layout'", because inlining a deinit requires a known layout that resilient mode deliberately hides. This mirrors the existing fix already applied to the equivalent storage classes in DequeModule (_DequeBuffer) and RopeModule (Rope._Storage). As noted there, this does not make anything ABI stable -- these storage classes are @usableFromInline internal and never part of the public ABI surface -- it only lets these modules build with library evolution enabled. Fixes #676. Co-Authored-By: Claude Opus 4.8 --- Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift | 1 + Sources/SortedCollections/BTree/_Node.Storage.swift | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift b/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift index 077318ae..766aaa77 100644 --- a/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift +++ b/Sources/HashTreeCollections/HashNode/_HashNode+Storage.swift @@ -37,6 +37,7 @@ extension _HashNode { /// Instances of this class hold (tail-allocated) storage for individual /// nodes in a hash tree. @usableFromInline + @_fixed_layout // Not really! This module isn't ABI stable. internal final class Storage: _RawHashStorage { @usableFromInline internal typealias Element = (key: Key, value: Value) diff --git a/Sources/SortedCollections/BTree/_Node.Storage.swift b/Sources/SortedCollections/BTree/_Node.Storage.swift index 14dadf6d..55edf20f 100644 --- a/Sources/SortedCollections/BTree/_Node.Storage.swift +++ b/Sources/SortedCollections/BTree/_Node.Storage.swift @@ -117,7 +117,8 @@ extension _Node { /// does not exist, ``_Node.dummyValue`` can be used to obtain a valid value within the type system /// that can be passed to APIs. @usableFromInline - internal class Storage: ManagedBuffer<_Node.Header, Key> { + @_fixed_layout // Not really! This module isn't ABI stable. + internal class Storage: ManagedBuffer<_Node.Header, Key> { /// Allows **read-only** access to the underlying data behind the node. /// /// - Parameter body: A closure with a handle which allows interacting with the node