Skip to content

Fix nightly-main build: guard versioned canImport(CryptoKit) checks - #226

Open
deadcaf3 wants to merge 1 commit into
apple:mainfrom
deadcaf3:fix/canimport-cryptokit-version-nightly
Open

deadcaf3 wants to merge 1 commit into
apple:mainfrom
deadcaf3:fix/canimport-cryptokit-version-nightly

Conversation

@deadcaf3

@deadcaf3 deadcaf3 commented Oct 7, 2026

Copy link
Copy Markdown

The nightly-main compiler warns on #if canImport(CryptoKit, _version:) where CryptoKit does not exist (CanImportMissingModule), and -warnings-as-errors makes that fatal on Linux. Introduced by #197.

  • Guard each versioned check with canImport(CryptoKit) &&, the remedy from the compiler's diagnostic docs.
  • No behaviour change: Linux still takes the SwiftCrypto fallback, Apple platforms are unchanged.
  • Verified in swiftlang/swift:nightly-main-jammy: ci-linux.sh and the static SDK build pass with the fix and fail without it.

The Swift 6.5 nightly compiler warns when a versioned
`#if canImport(Module, _version:)` names a module it cannot find
(CanImportMissingModule). CI builds with -warnings-as-errors, so the
four CryptoKit version checks in CryptoWrappers.swift failed the
Linux nightly-main jobs, where CryptoKit does not exist.

Follow the documented remedy: check that the module can be imported
at all before checking its version. The directive still evaluates to
false on Linux, so the SwiftCrypto fallback path is unchanged, and
older compilers accept the combined condition.
@rpaulo rpaulo added the 🔨 semver/patch No public API change. label Oct 7, 2026
@rpaulo rpaulo mentioned this pull request Oct 7, 2026

@rnro rnro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

finagolfin added a commit to finagolfin/swift-network-evolution that referenced this pull request Oct 7, 2026
@deadcaf3
deadcaf3 marked this pull request as ready for review October 7, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants