Summary
CryptoExtras fails to compile against the macOS 27 SDK (Xcode 27):
Sources/CryptoExtras/Digests/SHA512256Digest.swift:18:15: error: type 'SHA512256Digest' does not conform to protocol 'ContiguousBytes'
Foundation.ContiguousBytes.withBytes:3:8: note: protocol requires function 'withBytes' with type '<R, E> ((RawSpan) throws(E) -> R) throws(E) -> R'
Adding a single import Foundation to Sources/CryptoExtras/Digests/SHA512256Digest.swift fixes it.
Environment
- Xcode 27.0 (27A5228h), Apple Swift 6.3.3 (swift-6.3.3-RELEASE), macOS 27.0 SDK
- swift-crypto 4.5.0.
main looks affected too: the file still has no import statements.
Root cause
Three things combine.
- The macOS 27 SDK adds an availability-gated requirement to Foundation's
ContiguousBytes:
func withBytes<R, E>(_ body: (RawSpan) throws(E) -> R) throws(E) -> R.
Package.swift enables SE-0444 MemberImportVisibility for every target, in the "STANDARD CROSS-REPO SETTINGS DO NOT EDIT" loop. Under that feature a member declared in another module is only visible when that module is directly imported by the file using it.
Sources/CryptoExtras/Digests/SHA512256Digest.swift has no import statements at all.
So the default implementation Foundation provides for the new requirement is not visible in that file, the requirement is left without a witness, and the conformance fails.
Evidence that this is not a general SDK problem
A minimal conformer implementing only withUnsafeBytes compiles cleanly against the same SDK, at both -target arm64-apple-macos26.0 and -target arm64-apple-macos27.0:
import Foundation
@available(macOS 10.15, *)
public struct MyDigest: ContiguousBytes {
let bytes: (UInt64, UInt64, UInt64, UInt64)
public func withUnsafeBytes<R>(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R {
try Swift.withUnsafeBytes(of: bytes) { try body($0) }
}
}
Since that type provides no withBytes of its own and still conforms, Foundation does supply a usable default. It is the import visibility that hides it from SHA512256Digest.swift.
Consistent with that, SHA512256Digest.swift is the only file in CryptoExtras that declares a ContiguousBytes-related conformance without importing Foundation. Every other one imports it, including its own sibling SHA512256.swift (which imports Crypto).
Fix
+import Foundation
//===----------------------------------------------------------------------===//
//
Verified locally by patching only that file in the resolved checkout: swift build --target CryptoExtras goes from the error above to Build of target: 'CryptoExtras' complete!, with no other change.
Happy to open a PR if that would help.
Summary
CryptoExtrasfails to compile against the macOS 27 SDK (Xcode 27):Adding a single
import FoundationtoSources/CryptoExtras/Digests/SHA512256Digest.swiftfixes it.Environment
mainlooks affected too: the file still has no import statements.Root cause
Three things combine.
ContiguousBytes:func withBytes<R, E>(_ body: (RawSpan) throws(E) -> R) throws(E) -> R.Package.swiftenables SE-0444MemberImportVisibilityfor every target, in the "STANDARD CROSS-REPO SETTINGS DO NOT EDIT" loop. Under that feature a member declared in another module is only visible when that module is directly imported by the file using it.Sources/CryptoExtras/Digests/SHA512256Digest.swifthas no import statements at all.So the default implementation Foundation provides for the new requirement is not visible in that file, the requirement is left without a witness, and the conformance fails.
Evidence that this is not a general SDK problem
A minimal conformer implementing only
withUnsafeBytescompiles cleanly against the same SDK, at both-target arm64-apple-macos26.0and-target arm64-apple-macos27.0:Since that type provides no
withBytesof its own and still conforms, Foundation does supply a usable default. It is the import visibility that hides it fromSHA512256Digest.swift.Consistent with that,
SHA512256Digest.swiftis the only file inCryptoExtrasthat declares aContiguousBytes-related conformance without importing Foundation. Every other one imports it, including its own siblingSHA512256.swift(which importsCrypto).Fix
+import Foundation //===----------------------------------------------------------------------===// //Verified locally by patching only that file in the resolved checkout:
swift build --target CryptoExtrasgoes from the error above toBuild of target: 'CryptoExtras' complete!, with no other change.Happy to open a PR if that would help.