Skip to content

Conversation

@lorentey
Copy link
Member

This bumps the minimum required toolchain to Swift 6.0, and adds two new modules: ArrayModule and ContainersPreview, and a (for now, dormant) new package trait UnstableContainersPreview, to enable source-unstable prototypes.

ArrayModule will ship preview versions of new, noncopyable array variants. We currently have two of these: RigidArray and DynamicArray. Both are noncopyable, resizable array types with heap-allocated storage. DynamicArray implements dynamic storage resizing, while RigidArray requires manual capacity management, and in exchange it provides more predictable runtime performance and memory use.

ContainerPreview will ship source-unstable previews of new container protocols, providing a noncopyable/nonescapable-aware rethinking of Collection, focusing on predictably high performance. Initially, this is populated with the (planned to be source-stable) struct Box, a simple noncopyable, heap-allocated wrapper.

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate).
  • I've added benchmarks covering new functionality (if appropriate).
  • I've verified that my change does not break any existing tests or introduce unexplained benchmark regressions.
  • I've updated the documentation if necessary.

- Update minimum toolchain version to Swift 6.0.
- Add a separate package manifest for Swift 6.2+.
- Upgrade to Swift 6 language mode.
   - Except in _RopeModule, which has uncovered a language-mode related regression in debug builds.
- Define availability macros.
- Enable the Builtin module.
- For the 6.2+ manifest:
   - Add a new package trait called “UnstableContainersPreview”. This is not yet functional.
   - Enable experimental language features `Lifetimes` and `InoutLifetimeDependence`.
   - Stop supporting COLLECTIONS_SINGLE_MODULE in package builds.
- Update CMake & Xcode configurations to also assume Swift 6.2, reflecting the changes above.
This is just slapping `nonisolated(unsafe)` on global variables in the test suite.
Our tests do not support concurrent execution.
In preparation of adding the public, noncopyable Box type
These are precursors for container protocols, referenced by the new array tests
@lorentey lorentey added this to the 1.3.0 milestone Aug 17, 2025
@lorentey lorentey requested review from Azoy and glessard August 17, 2025 21:00
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey lorentey force-pushed the container-previews-1 branch 3 times, most recently from a04551c to 721cf95 Compare August 18, 2025 03:38
@lorentey lorentey force-pushed the container-previews-1 branch from 0e7db11 to 66c4937 Compare August 18, 2025 04:18
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey
Copy link
Member Author

😞

21:55:27  error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/swift/pm/swiftpm-xctest-helper /Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest /var/folders/bb/hcrjxg1s0b96pfst0ymhmp240000gn/T/TemporaryFile.mFbS3n output:
21:55:27      error: Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/swift-collectionsPackageTests, 0x0109): Library not loaded: @rpath/libswiftCompatibilitySpan.dylib
21:55:27        Referenced from: <C0A09E5A-DBBF-3609-8FF0-674941AB97AD> /Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/swift-collectionsPackageTests
21:55:27        Reason: tried: '/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/latest_toolchain/usr/lib/swift/macosx/testing/libswiftCompatibilitySpan.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/libswiftCompatibilitySpan.dylib' (no such file), '/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/../../../libswiftCompatibilitySpan.dylib' (no such file), '/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/../../../libswiftCompatibilitySpan.dylib' (no such file), '/Applications/Xcode.app/Contents/SharedFrameworks/libswiftCompatibilitySpan.dylib' (no such file), '/usr/local/lib/libswiftCompatibilitySpan.dylib' (no such file), '/usr/lib/libswiftCompatibilitySpan.dylib' (no such file, not in dyld cache)" UserInfo={NSLocalizedFailureReason=The bundle couldn’t be loaded., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/swift-collectionsPackageTests, NSDebugDescription=dlopen(/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/swift-collectionsPackageTests, 0x0109): Library not loaded: @rpath/libswiftCompatibilitySpan.dylib
21:55:27        Referenced from: <C0A09E5A-DBBF-3609-8FF0-674941AB97AD> /Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/swift-collectionsPackageTests
21:55:27        Reason: tried: '/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/latest_toolchain/usr/lib/swift/macosx/testing/libswiftCompatibilitySpan.dylib' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/libswiftCompatibilitySpan.dylib' (no such file), '/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/../../../libswiftCompatibilitySpan.dylib' (no such file), '/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest/Contents/MacOS/../../../libswiftCompatibilitySpan.dylib' (no such file), '/Applications/Xcode.app/Contents/SharedFrameworks/libswiftCompatibilitySpan.dylib' (no such file), '/usr/local/lib/libswiftCompatibilitySpan.dylib' (no such file), '/usr/lib/libswiftCompatibilitySpan.dylib' (no such file, not in dyld cache), NSBundlePath=/Users/ec2-user/jenkins/workspace/pr-swift-collections-macos/branch-main/swift-collections/.build/x86_64-apple-macosx/debug/swift-collectionsPackageTests.xctest, NSLocalizedDescription=The bundle “swift-collectionsPackageTests.xctest” couldn’t be loaded.}

@lorentey
Copy link
Member Author

@swift-ci test

Avoid using `@inlinable @_transparent` — the `@_transparent` attribute already implies inlinability, although evidently without the `@usableFromInline` parts. (`internal @_transparent` functions aren’t allowed to be called from inlinable functions.)

`@usableFromInline @_transparent` or `@_alwaysEmitIntoClient @_transparent` expresses the author’s intention better, making the choice of exposing a symbol explicit.
@lorentey lorentey force-pushed the container-previews-1 branch from 2aec2d5 to 5cd5197 Compare August 30, 2025 00:13
@lorentey lorentey merged commit b5fc030 into apple:main Aug 30, 2025
30 checks passed
@lorentey lorentey deleted the container-previews-1 branch August 30, 2025 01:23
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