Skip to content

Commit a3ac36c

Browse files
committed
[native] Stop using @_implementationOnly import in package configs
@_implementationOnly does not work correctly unless Swift’s Library Evolution dialect is enabled — it leads to obscure module loading failures. There seems to be no way to create a compile-time condition on whether library evolution is enabled, so we need to stop using @_implementationOnly imports in all package configurations.
1 parent ddacb08 commit a3ac36c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Sources/Atomics/Unmanaged extensions.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ internal func _sa_retain_n(_ object: UnsafeMutableRawPointer, _ delta: UInt32)
1616

1717
@_silgen_name("_sa_release_n")
1818
internal func _sa_release_n(_ object: UnsafeMutableRawPointer, _ delta: UInt32)
19-
#elseif ATOMICS_NATIVE_BUILTINS
20-
@_implementationOnly import _AtomicsShims
2119
#else
20+
// Note: with ATOMICS_NATIVE_BUILTINS, this file contains the last remaining
21+
// import of the shims module, and we only need it to get the declarations for
22+
// _sa_retain_n/_sa_release_n. The import is unfortunately still problematic;
23+
// these functions need to be moved into the stdlib or (preferably) we need
24+
// a compiler-level fix for https://bugs.swift.org/browse/SR-13708 to get rid
25+
// of it.
26+
//
27+
// Hiding the import using @_implementationOnly is not possible unless
28+
// Swift's library evolution dialect is enabled. (Which we cannot easily test
29+
// here.) Perhaps `internal import` will help work around this at some point.
2230
import _AtomicsShims
2331
#endif
2432

0 commit comments

Comments
 (0)