From f17980c2c536da48551bd8eef8d92aa689f505f6 Mon Sep 17 00:00:00 2001 From: Karoy Lorentey Date: Thu, 5 Nov 2026 16:12:17 -0800 Subject: [PATCH] Stop using @_addressableForDependencies --- CMakeLists.txt | 2 -- Package.swift | 2 -- Package@swift-6.2.swift | 2 -- .../RigidDictionary/RigidDictionary+Indices.swift | 7 ++----- .../BasicContainers/RigidDictionary/RigidDictionary.swift | 1 - .../UniqueDictionary/UniqueDictionary+Lookup.swift | 3 +-- .../UniqueDictionary/UniqueDictionary.swift | 1 - Xcode/Shared.xcconfig | 2 -- 8 files changed, 3 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1899364d..506483f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,8 +72,6 @@ set(collections_swift_flags "-enable-experimental-feature BuiltinModule" "-enable-experimental-feature Lifetimes" "-enable-experimental-feature InoutLifetimeDependence" - "-enable-experimental-feature AddressableParameters" - "-enable-experimental-feature AddressableTypes" "-enable-experimental-feature SuppressedAssociatedTypesWithDefaults" ) foreach(flag ${collections_swift_flags}) diff --git a/Package.swift b/Package.swift index 669453f2..7e33be35 100644 --- a/Package.swift +++ b/Package.swift @@ -113,8 +113,6 @@ let extraSettings: [SwiftSetting] = [ .enableExperimentalFeature("BuiltinModule"), .enableExperimentalFeature("Lifetimes"), .enableExperimentalFeature("InoutLifetimeDependence"), - .enableExperimentalFeature("AddressableParameters"), - .enableExperimentalFeature("AddressableTypes"), .enableExperimentalFeature("SuppressedAssociatedTypesWithDefaults"), // Requires Swift 6.4 // Note: if you touch these, please make sure to also update the similar lists in // CMakeLists.txt and Xcode/Shared.xcconfig. diff --git a/Package@swift-6.2.swift b/Package@swift-6.2.swift index c7aa6786..efb8ed3a 100644 --- a/Package@swift-6.2.swift +++ b/Package@swift-6.2.swift @@ -113,8 +113,6 @@ let extraSettings: [SwiftSetting] = [ .enableExperimentalFeature("BuiltinModule"), .enableExperimentalFeature("Lifetimes"), .enableExperimentalFeature("InoutLifetimeDependence"), - .enableExperimentalFeature("AddressableParameters"), - .enableExperimentalFeature("AddressableTypes"), // Note: if you touch these, please make sure to also update the similar lists in // CMakeLists.txt and Xcode/Shared.xcconfig. ] diff --git a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift index f71fd117..8835c928 100644 --- a/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift +++ b/Sources/BasicContainers/RigidDictionary/RigidDictionary+Indices.swift @@ -24,7 +24,7 @@ extension RigidDictionary where Key: ~Copyable, Value: ~Copyable { @_alwaysEmitIntoClient @_lifetime(borrow _base) - package init(_base: borrowing @_addressable _HTable) { + package init(_base: borrowing _HTable) { self._base = Ref(_base) } } @@ -70,10 +70,7 @@ where Key: ~Copyable, Value: ~Copyable @_lifetime(borrow self) public func makeBorrowingIterator() -> BorrowingIterator { - let bit = self._base.value.makeBucketIterator() - // FIXME: This override really should not be necessary. Check if the real `struct Borrow` fixes it. - let override = unsafe _overrideLifetime(bit, copying: self) - return BorrowingIterator(_it: override) + BorrowingIterator(_it: self._base.value.makeBucketIterator()) } } diff --git a/Sources/BasicContainers/RigidDictionary/RigidDictionary.swift b/Sources/BasicContainers/RigidDictionary/RigidDictionary.swift index af44da5a..e7b78371 100644 --- a/Sources/BasicContainers/RigidDictionary/RigidDictionary.swift +++ b/Sources/BasicContainers/RigidDictionary/RigidDictionary.swift @@ -31,7 +31,6 @@ public struct RigidDictionary< #else @available(SwiftStdlib 5.0, *) @frozen -@_addressableForDependencies @safe public struct RigidDictionary< Key: Hashable & ~Copyable, diff --git a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift index b4f02d4e..2ed9a02a 100644 --- a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift +++ b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary+Lookup.swift @@ -35,8 +35,7 @@ extension UniqueDictionary where Key: ~Copyable, Value: ~Copyable { public func value( forKey key: borrowing Key ) -> Ref? { - // FIXME: Why is this override necessary? Is it sound? It was triggered by RigidDictionary becoming `@_addressableForDependencies`. - unsafe _overrideLifetime(_storage.value(forKey: key), borrowing: self) + _storage.value(forKey: key) } /// Checks if the given key is present in the `RigidDictionary`, and returns diff --git a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary.swift b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary.swift index 6bdc3f36..1904fd36 100644 --- a/Sources/BasicContainers/UniqueDictionary/UniqueDictionary.swift +++ b/Sources/BasicContainers/UniqueDictionary/UniqueDictionary.swift @@ -25,7 +25,6 @@ public struct UniqueDictionary< #else @available(SwiftStdlib 5.0, *) @frozen -@_addressableForDependencies public struct UniqueDictionary< Key: Hashable & ~Copyable, Value: ~Copyable diff --git a/Xcode/Shared.xcconfig b/Xcode/Shared.xcconfig index 6fbf6e1c..10f3de53 100644 --- a/Xcode/Shared.xcconfig +++ b/Xcode/Shared.xcconfig @@ -38,8 +38,6 @@ OTHER_SWIFT_FLAGS = $(inherited) \ -enable-experimental-feature BuiltinModule \ -enable-experimental-feature Lifetimes \ -enable-experimental-feature InoutLifetimeDependence \ - -enable-experimental-feature AddressableParameters \ - -enable-experimental-feature AddressableTypes \ -enable-experimental-feature SuppressedAssociatedTypesWithDefaults \ -enable-experimental-feature "AvailabilityMacro=SwiftStdlib 5.0: macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2" \ -enable-experimental-feature "AvailabilityMacro=SwiftStdlib 5.1: macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0" \