[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.
This commit is contained in:
Karoy Lorentey committed 2023-12-12 12:05:41 -08:00
1 parent ddacb0864c
commit a3ac36c96d
1 file changed
+10 -2
+10 -2
View File
@@ -16,9 +16,17 @@ internal func _sa_retain_n(_ object: UnsafeMutableRawPointer, _ delta: UInt32)
@_silgen_name("_sa_release_n")
internal func _sa_release_n(_ object: UnsafeMutableRawPointer, _ delta: UInt32)
#elseif ATOMICS_NATIVE_BUILTINS
@_implementationOnly import _AtomicsShims
#else
// Note: with ATOMICS_NATIVE_BUILTINS, this file contains the last remaining
// import of the shims module, and we only need it to get the declarations for
// _sa_retain_n/_sa_release_n. The import is unfortunately still problematic;
// these functions need to be moved into the stdlib or (preferably) we need
// a compiler-level fix for https://bugs.swift.org/browse/SR-13708 to get rid
// of it.
//
// Hiding the import using @_implementationOnly is not possible unless
// Swift's library evolution dialect is enabled. (Which we cannot easily test
// here.) Perhaps `internal import` will help work around this at some point.
import _AtomicsShims
#endif