Skip to content

Commit 6dcf7c6

Browse files
authored
Merge pull request #78617 from etcwilde/ewilde/value-generic-types
Values in generic types are only available in 6.2
2 parents 4420f27 + 6f823dc commit 6dcf7c6

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

stdlib/public/core/Slab.swift

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,46 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// A fixed-size array.
14-
@available(SwiftStdlib 6.1, *)
14+
@available(SwiftStdlib 6.2, *)
1515
@frozen
1616
public struct Slab<let count: Int, Element: ~Copyable>: ~Copyable {
1717
@usableFromInline
1818
internal let _storage: Builtin.FixedArray<count, Element>
1919
}
2020

21-
@available(SwiftStdlib 6.1, *)
21+
@available(SwiftStdlib 6.2, *)
2222
extension Slab: Copyable where Element: Copyable {}
2323

24-
@available(SwiftStdlib 6.1, *)
24+
@available(SwiftStdlib 6.2, *)
2525
extension Slab: BitwiseCopyable where Element: BitwiseCopyable {}
2626

27-
@available(SwiftStdlib 6.1, *)
27+
@available(SwiftStdlib 6.2, *)
2828
extension Slab: @unchecked Sendable where Element: Sendable & ~Copyable {}
2929

3030
//===----------------------------------------------------------------------===//
3131
// Address & Buffer
3232
//===----------------------------------------------------------------------===//
3333

34-
@available(SwiftStdlib 6.1, *)
34+
@available(SwiftStdlib 6.2, *)
3535
extension Slab where Element: ~Copyable {
3636
/// Returns a read-only pointer to the first element in the vector.
37-
@available(SwiftStdlib 6.1, *)
37+
@available(SwiftStdlib 6.2, *)
3838
@_alwaysEmitIntoClient
3939
@_transparent
4040
internal var _address: UnsafePointer<Element> {
4141
UnsafePointer<Element>(Builtin.unprotectedAddressOfBorrow(self))
4242
}
4343

4444
/// Returns a buffer pointer over the entire vector.
45-
@available(SwiftStdlib 6.1, *)
45+
@available(SwiftStdlib 6.2, *)
4646
@_alwaysEmitIntoClient
4747
@_transparent
4848
internal var _buffer: UnsafeBufferPointer<Element> {
4949
UnsafeBufferPointer<Element>(start: _address, count: count)
5050
}
5151

5252
/// Returns a mutable pointer to the first element in the vector.
53-
@available(SwiftStdlib 6.1, *)
53+
@available(SwiftStdlib 6.2, *)
5454
@_alwaysEmitIntoClient
5555
@_transparent
5656
internal var _mutableAddress: UnsafeMutablePointer<Element> {
@@ -60,7 +60,7 @@ extension Slab where Element: ~Copyable {
6060
}
6161

6262
/// Returns a mutable buffer pointer over the entire vector.
63-
@available(SwiftStdlib 6.1, *)
63+
@available(SwiftStdlib 6.2, *)
6464
@_alwaysEmitIntoClient
6565
@_transparent
6666
internal var _mutableBuffer: UnsafeMutableBufferPointer<Element> {
@@ -71,7 +71,7 @@ extension Slab where Element: ~Copyable {
7171

7272
/// Returns the given raw pointer, which points at an uninitialized vector
7373
/// instance, to a mutable buffer suitable for initialization.
74-
@available(SwiftStdlib 6.1, *)
74+
@available(SwiftStdlib 6.2, *)
7575
@_alwaysEmitIntoClient
7676
@_transparent
7777
internal static func _initializationBuffer(
@@ -88,7 +88,7 @@ extension Slab where Element: ~Copyable {
8888
// Initialization APIs
8989
//===----------------------------------------------------------------------===//
9090

91-
@available(SwiftStdlib 6.1, *)
91+
@available(SwiftStdlib 6.2, *)
9292
extension Slab where Element: ~Copyable {
9393
/// Initializes every element in this vector running the given closure value
9494
/// that returns the element to emplace at the given index.
@@ -102,7 +102,7 @@ extension Slab where Element: ~Copyable {
102102
///
103103
/// - Parameter body: A closure that returns an owned `Element` to emplace at
104104
/// the passed in index.
105-
@available(SwiftStdlib 6.1, *)
105+
@available(SwiftStdlib 6.2, *)
106106
@_alwaysEmitIntoClient
107107
public init<E: Error>(_ body: (Int) throws(E) -> Element) throws(E) {
108108
self = try Builtin.emplace { (rawPtr) throws(E) -> () in
@@ -141,7 +141,7 @@ extension Slab where Element: ~Copyable {
141141
/// - Parameter next: A closure that passes in an immutable borrow reference
142142
/// of the given first element of the vector which returns
143143
/// an owned `Element` instance to insert into the vector.
144-
@available(SwiftStdlib 6.1, *)
144+
@available(SwiftStdlib 6.2, *)
145145
@_alwaysEmitIntoClient
146146
public init<E: Error>(
147147
first: consuming Element,
@@ -175,12 +175,12 @@ extension Slab where Element: ~Copyable {
175175
}
176176
}
177177

178-
@available(SwiftStdlib 6.1, *)
178+
@available(SwiftStdlib 6.2, *)
179179
extension Slab where Element: Copyable {
180180
/// Initializes every element in this vector to a copy of the given value.
181181
///
182182
/// - Parameter value: The instance to initialize this vector with.
183-
@available(SwiftStdlib 6.1, *)
183+
@available(SwiftStdlib 6.2, *)
184184
@_alwaysEmitIntoClient
185185
public init(repeating value: Element) {
186186
self = Builtin.emplace {
@@ -195,22 +195,22 @@ extension Slab where Element: Copyable {
195195
// Collection APIs
196196
//===----------------------------------------------------------------------===//
197197

198-
@available(SwiftStdlib 6.1, *)
198+
@available(SwiftStdlib 6.2, *)
199199
extension Slab where Element: ~Copyable {
200200
/// The type of the container's elements.
201-
@available(SwiftStdlib 6.1, *)
201+
@available(SwiftStdlib 6.2, *)
202202
public typealias Element = Element
203203

204204
/// A type that represents a position in the collection.
205205
///
206206
/// Valid indices consist of the position of every element and a
207207
/// "past the end" position that's not valid for use as a subscript
208208
/// argument.
209-
@available(SwiftStdlib 6.1, *)
209+
@available(SwiftStdlib 6.2, *)
210210
public typealias Index = Int
211211

212212
/// The number of elements in the collection.
213-
@available(SwiftStdlib 6.1, *)
213+
@available(SwiftStdlib 6.2, *)
214214
@_alwaysEmitIntoClient
215215
@_transparent
216216
public static var count: Int {
@@ -220,7 +220,7 @@ extension Slab where Element: ~Copyable {
220220
/// The number of elements in the collection.
221221
///
222222
/// - Complexity: O(1)
223-
@available(SwiftStdlib 6.1, *)
223+
@available(SwiftStdlib 6.2, *)
224224
@_alwaysEmitIntoClient
225225
@_transparent
226226
public var count: Int {
@@ -230,7 +230,7 @@ extension Slab where Element: ~Copyable {
230230
/// The position of the first element in a nonempty collection.
231231
///
232232
/// If the collection is empty, `startIndex` is equal to `endIndex`.
233-
@available(SwiftStdlib 6.1, *)
233+
@available(SwiftStdlib 6.2, *)
234234
@_alwaysEmitIntoClient
235235
@_transparent
236236
public var startIndex: Int {
@@ -252,7 +252,7 @@ extension Slab where Element: ~Copyable {
252252
/// // Prints "[30, 40, 50]"
253253
///
254254
/// If the collection is empty, `endIndex` is equal to `startIndex`.
255-
@available(SwiftStdlib 6.1, *)
255+
@available(SwiftStdlib 6.2, *)
256256
@_alwaysEmitIntoClient
257257
@_transparent
258258
public var endIndex: Int {
@@ -276,7 +276,7 @@ extension Slab where Element: ~Copyable {
276276
/// i = c.index(after: i)
277277
/// }
278278
/// // c == MyFancyCollection([2, 4, 6, 8, 10])
279-
@available(SwiftStdlib 6.1, *)
279+
@available(SwiftStdlib 6.2, *)
280280
@_alwaysEmitIntoClient
281281
@_transparent
282282
public var indices: Range<Int> {
@@ -288,7 +288,7 @@ extension Slab where Element: ~Copyable {
288288
/// - Parameter i: A valid index of the collection. `i` must be less than
289289
/// `endIndex`.
290290
/// - Returns: The index immediately after `i`.
291-
@available(SwiftStdlib 6.1, *)
291+
@available(SwiftStdlib 6.2, *)
292292
@_alwaysEmitIntoClient
293293
@_transparent
294294
public borrowing func index(after i: Int) -> Int {
@@ -300,7 +300,7 @@ extension Slab where Element: ~Copyable {
300300
/// - Parameter i: A valid index of the collection. `i` must be greater than
301301
/// `startIndex`.
302302
/// - Returns: The index value immediately before `i`.
303-
@available(SwiftStdlib 6.1, *)
303+
@available(SwiftStdlib 6.2, *)
304304
@_alwaysEmitIntoClient
305305
@_transparent
306306
public borrowing func index(before i: Int) -> Int {
@@ -326,7 +326,7 @@ extension Slab where Element: ~Copyable {
326326
/// `endIndex` property.
327327
///
328328
/// - Complexity: O(1)
329-
@available(SwiftStdlib 6.1, *)
329+
@available(SwiftStdlib 6.2, *)
330330
@_addressableSelf
331331
@_alwaysEmitIntoClient
332332
public subscript(_ i: Int) -> Element {
@@ -350,7 +350,7 @@ extension Slab where Element: ~Copyable {
350350
// Swap
351351
//===----------------------------------------------------------------------===//
352352

353-
@available(SwiftStdlib 6.1, *)
353+
@available(SwiftStdlib 6.2, *)
354354
extension Slab where Element: ~Copyable {
355355
/// Exchanges the values at the specified indices of the vector.
356356
///
@@ -363,7 +363,7 @@ extension Slab where Element: ~Copyable {
363363
/// - j: The index of the second value to swap.
364364
///
365365
/// - Complexity: O(1)
366-
@available(SwiftStdlib 6.1, *)
366+
@available(SwiftStdlib 6.2, *)
367367
@_alwaysEmitIntoClient
368368
public mutating func swapAt(
369369
_ i: Int,
@@ -387,7 +387,7 @@ extension Slab where Element: ~Copyable {
387387
// Unsafe APIs
388388
//===----------------------------------------------------------------------===//
389389

390-
@available(SwiftStdlib 6.1, *)
390+
@available(SwiftStdlib 6.2, *)
391391
extension Slab where Element: ~Copyable {
392392
/// Calls a closure with a pointer to the vector's contiguous storage.
393393
///
@@ -422,7 +422,7 @@ extension Slab where Element: ~Copyable {
422422
/// `withUnsafeBufferPointer(_:)` method. The pointer argument is valid only
423423
/// for the duration of the method's execution.
424424
/// - Returns: The return value, if any, of the `body` closure parameter.
425-
@available(SwiftStdlib 6.1, *)
425+
@available(SwiftStdlib 6.2, *)
426426
@_alwaysEmitIntoClient
427427
@_transparent
428428
public borrowing func _withUnsafeBufferPointer<Result: ~Copyable, E: Error>(
@@ -471,7 +471,7 @@ extension Slab where Element: ~Copyable {
471471
/// for the `withUnsafeMutableBufferPointer(_:)` method. The pointer
472472
/// argument is valid only for the duration of the method's execution.
473473
/// - Returns: The return value, if any, of the `body` closure parameter.
474-
@available(SwiftStdlib 6.1, *)
474+
@available(SwiftStdlib 6.2, *)
475475
@_alwaysEmitIntoClient
476476
@_transparent
477477
public mutating func _withUnsafeMutableBufferPointer<Result: ~Copyable, E: Error>(

0 commit comments

Comments
 (0)