Modern Swift concurrency#2
Merged
Merged
Conversation
…rrency Enable the Approachable Concurrency upcoming features on every target (NonisolatedNonsendingByDefault and InferIsolatedConformances). The public async entry points (CIFP(url:), CIFP(bytes:), and linked()) now run on the caller's executor by default, and the streaming line reader's next() is annotated @Concurrent so file and byte iteration keep running off the caller's executor. SwiftCIFP was already close to modern structured concurrency (actor-based data model, async inits, hand-rolled AsyncSequence readers, async @sendable resolver closures, zero GCD/threads/locks), so the migration focused on removing the remaining escape hatches: - Remove both nonisolated(unsafe) static-regex escape hatches: the two header-parsing regexes now live as instance stored properties on CIFPBuilder, compiled once per parse rather than as shared unsafe statics (no perf regression). - Drop a vestigial @preconcurrency from import RegexBuilder; the module is fully Sendable-audited under Swift 6 and builds clean. The remaining @unchecked Sendable conformances (UnitSlope and UnitConverterDegrees) are unavoidable Foundation Dimension/UnitConverter patterns and are kept by design. No public signatures changed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3059fc7 to
6b11542
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adopts Swift's Approachable Concurrency upcoming features and finishes the migration to modern structured concurrency.
NonisolatedNonsendingByDefaultandInferIsolatedConformanceson every target. The publicasyncentry points (CIFP(url:),CIFP(bytes:), andlinked()) now run on the caller's executor by default, and the streaming line reader'snext()is annotated@concurrentso file and byte iteration keep running off the caller's executor.nonisolated(unsafe)escape hatches: the two header-parsing regexes are now compiled once per parse on the builder instead of stored as shared unsafe statics (no perf regression).@preconcurrencyfromimport RegexBuilder; the module is fullySendable-audited under Swift 6.SwiftCIFP was already close to modern structured concurrency (actor-based data model, async inits, hand-rolled
AsyncSequencereaders, async@Sendableresolver closures, zero GCD/threads/locks). The remaining@unchecked Sendableconformances (UnitSlopeandUnitConverterDegrees) are unavoidable FoundationDimension/UnitConverterpatterns and are kept by design.No public signatures changed; this is a source-compatible change.
Verification
swift build --build-testssucceeds.swift-formatandswiftlintare clean on the changed files.Version
This release is 1.1.0 (minor: public async execution semantics change while remaining source-compatible). The GitHub release will be cut after this PR is merged.
🤖 Generated with Claude Code