Skip to content

Commit 6bcb663

Browse files
authored
Merge pull request #450 from lorentey/merge.release-1.2→main
Merge release/1.2 to main
2 parents 66e29ec + 0f73f0a commit 6bcb663

File tree

83 files changed

+285
-2152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+285
-2152
lines changed

.editorconfig

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
insert_final_newline = true
6+
end_of_line = lf
7+
trim_trailing_whitespace = true
8+
9+
[*.{swift,swift.gyb,cpp,h,yml}]
10+
indent_style = space
11+
tab_width = 4
12+
indent_size = 2
13+
14+
[*.{sh,py}]
15+
indent_style = space
16+
indent_size = 4
17+
18+
[.swiftci/*}]
19+
indent_style = space
20+
indent_size = 4
21+
22+
[CMakeLists.txt]
23+
indent_style = space
24+
indent_size = 2
25+
26+
[*.cmake{,.in}]
27+
indent_style = space
28+
indent_size = 2
29+
30+
[*.{md,txt}]
31+
indent_style = space
32+
indent_size = 2
33+
34+
[*.xcconfig]
35+
indent_style = space
36+
indent_size = 2
37+
38+
[*.pbxproj]
39+
indent_style = tab
40+
tab_width = 4
41+
indent_size = 4

.github/workflows/pull_request.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88
tests:
99
name: Test
1010
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
11+
with:
12+
linux_exclude_swift_versions: '[{"swift_version": "5.8"}, {"swift_version": "5.9"}]'
13+
windows_exclude_swift_versions: '[{"swift_version": "5.9"}]'
1114
soundness:
1215
name: Soundness
1316
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
1515

1616
include(PlatformInfo)
1717

18+
if(NOT SWIFT_SYSTEM_NAME)
19+
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
20+
set(SWIFT_SYSTEM_NAME macosx)
21+
else()
22+
set(SWIFT_SYSTEM_NAME "$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
23+
endif()
24+
endif()
25+
26+
include(PlatformInfo)
27+
1828
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
1929
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
2030

@@ -36,6 +46,7 @@ if(COLLECTIONS_FOUNDATION_TOOLCHAIN_MODULE)
3646
endif()
3747

3848
include(CTest)
49+
include(GNUInstallDirs)
3950
include(SwiftSupport)
4051

4152
add_subdirectory(Sources)

Package.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:5.10
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the Swift Collections open source project
@@ -188,17 +188,13 @@ let targets: [CustomTarget] = [
188188
name: "InternalCollectionsUtilities",
189189
exclude: [
190190
"CMakeLists.txt",
191-
"Compatibility/UnsafeMutableBufferPointer+SE-0370.swift.gyb",
192-
"Compatibility/UnsafeMutablePointer+SE-0370.swift.gyb",
193-
"Compatibility/UnsafeRawPointer extensions.swift.gyb",
194191
"Debugging.swift.gyb",
195192
"Descriptions.swift.gyb",
196193
"IntegerTricks/FixedWidthInteger+roundUpToPowerOfTwo.swift.gyb",
197194
"IntegerTricks/Integer rank.swift.gyb",
198195
"IntegerTricks/UInt+first and last set bit.swift.gyb",
199196
"IntegerTricks/UInt+reversed.swift.gyb",
200197
"RandomAccessCollection+Offsets.swift.gyb",
201-
"Specialize.swift.gyb",
202198
"UnsafeBitSet/_UnsafeBitSet+Index.swift.gyb",
203199
"UnsafeBitSet/_UnsafeBitSet+_Word.swift.gyb",
204200
"UnsafeBitSet/_UnsafeBitSet.swift.gyb",

README.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ The package currently provides the following implementations:
3131
[TreeSet]: https://swiftpackageindex.com/apple/swift-collections/1.1.0/documentation/hashtreecollections/treeset
3232
[TreeDictionary]: https://swiftpackageindex.com/apple/swift-collections/1.1.0/documentation/hashtreecollections/treedictionary
3333

34-
The following additional data structures are currently under development but they aren't stable enough to preview yet.
35-
36-
- [`SortedSet` and `SortedDictionary`](https://github.com/apple/swift-collections/pull/65), sorted collections backed by in-memory persistent b-trees.
37-
- [`SparseSet`](https://github.com/apple/swift-collections/pull/80), a constant time set construct, trading off memory for speed.
38-
3934
Swift Collections uses the same modularization approach as [**Swift Numerics**](https://github.com/apple/swift-numerics): it provides a standalone module for each thematic group of data structures it implements. For instance, if you only need a double-ended queue type, you can pull in only that by importing `DequeModule`. `OrderedSet` and `OrderedDictionary` share much of the same underlying implementation, so they are provided by a single module, called `OrderedCollections`. However, there is also a top-level `Collections` module that gives you every collection type with a single import statement:
4035

4136
``` swift
@@ -53,10 +48,11 @@ The Swift Collections package is source stable. The version numbers follow [Sema
5348

5449
[semver]: https://semver.org
5550

56-
The public API of version 1.1 of the `swift-collections` package consists of non-underscored declarations that are marked `public` in the `Collections`, `BitCollections`, `DequeModule`, `HeapModule`, `OrderedCollections` and `HashTreeCollections` modules.
51+
### Public API
52+
53+
The public API of version 1.2 of the `swift-collections` package consists of non-underscored declarations that are marked `public` in the `Collections`, `BitCollections`, `DequeModule`, `HeapModule`, `OrderedCollections` and `HashTreeCollections` modules.
5754

58-
Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
59-
If you have a use case that requires using underscored APIs, please [submit a Feature Request][enhancement] describing it! We'd like the public interface to be as useful as possible -- although preferably without compromising safety or limiting future evolution.
55+
Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
6056

6157
By "underscored declarations" we mean declarations that have a leading underscore anywhere in their fully qualified name. For instance, here are some names that wouldn't be considered part of the public API, even if they were technically marked public:
6258

@@ -65,36 +61,42 @@ By "underscored declarations" we mean declarations that have a leading underscor
6561
- `_FooModule.Bar` (underscored module)
6662
- `FooModule.Bar.init(_value:)` (underscored initializer)
6763

68-
Note that contents of the `Tests`, `Utils` and `Benchmarks` subdirectories aren't public API. We don't make any source compatibility promises about them -- they may change at whim, and code may be removed in any new release. Do not rely on anything about them.
64+
If you have a use case that requires using underscored (or otherwise non-public) APIs, please [submit a Feature Request][enhancement] describing it! We'd like the public interface to be as useful as possible -- although preferably without compromising safety or limiting future evolution.
65+
66+
This source compatibility promise only applies to swift-collection when built as a Swift package. (The repository also contains unstable configurations for building swift-collections using CMake and Xcode. These configurations are provided for internal Swift project use only -- such as for building the (private) swift-collections binaries that ship within Swift toolchains.)
67+
68+
Note that the files in the `Tests`, `Utils`, `Documentation`, `Xcode`, `cmake` and `Benchmarks` subdirectories may change at whim; they may be added, modified or removed in any new release. Do not rely on anything about them.
6969

7070
Future minor versions of the package may update these rules as needed.
7171

72+
### Minimum Required Swift Toolchain Version
73+
7274
We'd like this package to quickly embrace Swift language and toolchain improvements that are relevant to its mandate. Accordingly, from time to time, new versions of this package require clients to upgrade to a more recent Swift toolchain release. (This allows the package to make use of new language/stdlib features, build on compiler bug fixes, and adopt new package manager functionality as soon as they are available.) Patch (i.e., bugfix) releases will not increase the required toolchain version, but any minor (i.e., new feature) release may do so.
7375

74-
The following table maps existing package releases to their minimum required Swift toolchain release:
76+
The following table maps package releases to their minimum required Swift toolchain release:
7577

7678
| Package version | Swift version | Xcode release |
7779
| ----------------------- | --------------- | ------------- |
7880
| swift-collections 1.0.x | >= Swift 5.3.2 | >= Xcode 12.4 |
7981
| swift-collections 1.1.x | >= Swift 5.7.2 | >= Xcode 14.2 |
82+
| swift-collections 1.2.x | >= Swift 5.10.0 | >= Xcode 15.3 |
8083

8184
(Note: the package has no minimum deployment target, so while it does require clients to use a recent Swift toolchain to build it, the code itself is able to run on any OS release that supports running Swift code.)
8285

83-
8486
## Using **Swift Collections** in your project
8587

8688
To use this package in a SwiftPM project, you need to set it up as a package dependency:
8789

8890
```swift
89-
// swift-tools-version:5.9
91+
// swift-tools-version:6.1
9092
import PackageDescription
9193

9294
let package = Package(
9395
name: "MyPackage",
9496
dependencies: [
9597
.package(
9698
url: "https://github.com/apple/swift-collections.git",
97-
.upToNextMinor(from: "1.1.0") // or `.upToNextMajor
99+
.upToNextMinor(from: "1.2.0") // or `.upToNextMajor
98100
)
99101
],
100102
targets: [
@@ -120,17 +122,19 @@ If you find something that looks like a bug, please open a [Bug Report][bugrepor
120122

121123
We maintain separate branches for each minor version of the package:
122124

123-
| Package version | Branch |
124-
| ----------------------- | ----------- |
125-
| swift-collections 1.0.x | release/1.0 |
126-
| swift-collections 1.1.x | release/1.1 |
127-
| swift-collections 1.2.x | main |
125+
| Package version | Branch | Status |
126+
| ----------------------- | ----------- | -------- |
127+
| swift-collections 1.0.x | release/1.0 | Obsolete |
128+
| swift-collections 1.1.x | release/1.1 | Critical bugfixes only |
129+
| swift-collections 1.2.x | release/1.2 | Critical bugfixes only |
130+
| swift-collections 1.3.x | main | Feature work towards next minor release |
131+
| n.a. | future | Experimental prototyping |
128132

129133
Changes must land on the branch corresponding to the earliest release that they will need to ship on. They are periodically propagated to subsequent branches, in the following direction:
130134

131-
`release/1.0``release/1.1``main`
135+
`release/1.0``release/1.1``release/1.2``main`
132136

133-
For example, anything landing on `release/1.0` will eventually appear on `release/1.1` and then `main` too; there is no need to file standalone PRs for each release line. (Change propagation currently requires manual work -- it is performed by project maintainers.)
137+
For example, anything landing on `release/1.1` will eventually appear on `release/1.2` and then `main` too; there is no need to file standalone PRs for each release line. Change propagation is not instantaneous, as it currently requires manual work -- it is performed by project maintainers.
134138

135139
### Working on the package
136140

@@ -160,6 +164,10 @@ By submitting a pull request, you represent that you have the right to license y
160164

161165
#### Proposing the addition of a new data structure
162166

167+
**Note:** As of 2024, we are fully preoccupied with refactoring our existing data structures to support noncopyable and/or nonescapable element types; this includes designing new container protocols around them. I don't expect we'll have capacity to work on any major new data structure implementations until this effort is complete.
168+
169+
<!--
170+
163171
We intend this package to collect generally useful data structures -- the ones that ought to be within easy reach of every Swift engineer's basic toolbox. The implementations we ship need to be of the highest technical quality, polished to the same shine as anything that gets included in the Swift Standard Library. (The only real differences are that this package isn't under the formal Swift Evolution process, and its code isn't ABI stable.)
164172
165173
Accordingly, adding a new data structure to this package is not an easy or quick process, and not all useful data structures are going to be a good fit.
@@ -174,6 +182,7 @@ Participate in the review discussion, and adapt code accordingly. Sometimes we m
174182
175183
Historically, PRs adding a new data structure have typically been merged to a new feature branch rather than directly to a release branch or `main`, and there was an extended amount of time between the initial merge and the tag that shipped the new feature. Nobody likes to wait, but getting a new data structure implementation from a state that was ready to merge to a state that's ready to ship is actually quite difficult work, and it takes maintainer time and effort that needs to be scheduled in advance. The closer an implementation is to the coding conventions and performance baseline of the Standard Library, the shorter this wait is likely to become, and the fewer changes there will be between merging and shipping.
176184
185+
-->
177186

178187
### Code of Conduct
179188

Sources/BitCollections/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ target_sources(${module_name} PRIVATE
3232
"BitArray/BitArray+Descriptions.swift"
3333
"BitArray/BitArray+Equatable.swift"
3434
"BitArray/BitArray+ExpressibleByArrayLiteral.swift"
35+
"BitArray/BitArray+ExpressibleByStringLiteral.swift"
3536
"BitArray/BitArray+Extras.swift"
3637
"BitArray/BitArray+Fill.swift"
3738
"BitArray/BitArray+Hashable.swift"
3839
"BitArray/BitArray+Initializers.swift"
3940
"BitArray/BitArray+Invariants.swift"
41+
"BitArray/BitArray+LosslessStringConvertible.swift"
4042
"BitArray/BitArray+RandomBits.swift"
4143
"BitArray/BitArray+RangeReplaceableCollection.swift"
4244
"BitArray/BitArray+Testing.swift"

Sources/DequeModule/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ target_sources(${module_name} PRIVATE
3131
"Deque+ExpressibleByArrayLiteral.swift"
3232
"Deque+Extras.swift"
3333
"Deque+Hashable.swift"
34-
"Deque+Sendable.swift"
3534
"Deque+Testing.swift"
3635
"Deque._Storage.swift"
3736
"Deque._UnsafeHandle.swift"

Sources/DequeModule/Deque+Collection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ extension Deque: Sequence {
164164
}
165165
}
166166

167-
extension Deque.Iterator: Sendable where Element: Sendable {}
167+
extension Deque.Iterator: @unchecked Sendable where Element: Sendable {}
168168

169169
extension Deque: RandomAccessCollection {
170170
public typealias Index = Int

Sources/DequeModule/Deque+Sendable.swift

Lines changed: 0 additions & 12 deletions
This file was deleted.

Sources/DequeModule/Deque.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,5 @@ public struct Deque<Element> {
103103
self._storage = _Storage(minimumCapacity: minimumCapacity)
104104
}
105105
}
106+
107+
extension Deque: @unchecked Sendable where Element: Sendable {}

0 commit comments

Comments
 (0)