Skip to content

Upgrade to Swift 6.4 and adopt Swift 7 upcoming features - #10

Merged
iamcarbon merged 2 commits into
mainfrom
claude/swift-6-4-upgrade-4a69d0
Sep 15, 2026
Merged

iamcarbon merged 2 commits into
mainfrom
claude/swift-6-4-upgrade-4a69d0

Conversation

@myluma

@myluma myluma commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

What changed

Swift 6.4

  • swift-tools-version 6.2 → 6.4; README requirements updated.
  • CI moves from macos-15 / Xcode 26 to macos-26 / Xcode 27.

Swift 7 upcoming features, enabled on both targets in Package.swift:

  • InternalImportsByDefault: imports are internal unless marked, so CTantivy no longer leaks into the public interface (checked in the emitted .swiftinterface). The 8 files that expose URL/Data/Date publicly now use public import Foundation.
  • ExistentialAny: 29 sites spelled any CodingKey / any Decoder / etc., almost all in SearchHitDecoder.swift.
  • MemberImportVisibility, InferIsolatedConformances, NonisolatedNonsendingByDefault: no code changes needed.

Small fixes

  • SearchCollection is now checked Sendable instead of @unchecked. It only stores let index: Index.
  • Query.swift: removed a dead $0 == nil comparison on a non-optional UInt64, which 6.4 warns about. No behavior change.
  • A test had a try with nothing that could throw.

Rust build on macOS 27

  • rust/Cargo.toml sets [profile.release.build-override] strip = false. Cargo strips build-time proc-macro dylibs in release by default, and on macOS 27 dyld refuses to load the stripped files ("mis-aligned LINKEDIT string pool"). scripts/build-host.sh then fails with can't find crate for serde_derive. The setting only applies to build-time helpers, so the shipped static library is unchanged.

Reviewer notes

  • CI runner: I haven't confirmed that GitHub's macos-26 image has Xcode 27 yet. If the "Select Xcode" step fails, the runner or the xcode-version needs adjusting.
  • Minimum toolchain: consumers now need Swift 6.4 / Xcode 27 to resolve the package. The deployment targets (macOS 15 / iOS 18) are unchanged.
  • Considered and not adopted:
    • A Span-based MessagePack reader: Array.span needs macOS 26, and storing a RawSpan in a cursor needs experimental lifetime features.
    • ~Sendable on IndexWriter: it doesn't stop a client from adding a retroactive @unchecked Sendable, so it would only be documentation.
    • Strict memory safety: roughly 108 unsafe markers across the FFI layer. Possible follow-up.

Testing

  • swift test: 345 tests in 32 suites pass with zero warnings, both against the released 0.7.0 xcframework and in host mode against a locally built libtantivy_ffi.a.
  • A clean cargo build --release into a fresh target dir succeeds with the Cargo.toml change alone, no environment workaround.

🤖 Generated with Claude Code

iamcarbon and others added 2 commits September 14, 2026 19:18
Bump swift-tools-version to 6.4 (Xcode 27) and move CI to a runner with it.

Enable ExistentialAny, InternalImportsByDefault, MemberImportVisibility,
InferIsolatedConformances and NonisolatedNonsendingByDefault on both targets.
With imports internal by default, the CTantivy C module no longer appears in
the public interface; files exposing Foundation types use `public import`.

SearchCollection drops @unchecked: it only stores a Sendable `let`, so the
conformance can be checked. Also fix two warnings the 6.4 compiler surfaced:
a dead `nil` comparison on a non-optional in the more_like_this writer, and a
needless `try` in a test.

Stop cargo stripping build-time proc-macros in release: on macOS 27 dyld
rejects the stripped dylibs ("mis-aligned LINKEDIT string pool"), failing
scripts/build-host.sh with "can't find crate".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GitHub's macos-26 image only carries Xcode 26.x, so setup-xcode could not
satisfy '27' and the job failed before building anything. Xcode 27 is
available on a separate preview image selected with the `xcode-27` label.
That image ships a single Xcode that is already the default, so the
setup-xcode step is dropped rather than retargeted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@iamcarbon
iamcarbon merged commit 45edea6 into main Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants