Skip to content

Commit 4d8b499

Browse files
committed
stdlib: Backward deployment of Span and RawSpan
1 parent 2056d72 commit 4d8b499

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

stdlib/public/core/Span/RawSpan.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import Swift
2222
/// owning the contiguous memory, ensuring temporal safety and avoiding
2323
/// use-after-free errors. Operations on `RawSpan` are bounds-checked,
2424
/// ensuring spcial safety and avoiding buffer overflow errors.
25-
@available(SwiftStdlib 6.1, *)
25+
@available(SwiftStdlib 5.0, *)
26+
@_originallyDefinedIn(module: "Swift", _linkerModule: "Compatibility62", SwiftStdlib 6.0)
2627
@frozen
2728
@safe
2829
public struct RawSpan: ~Escapable, Copyable, BitwiseCopyable {
@@ -83,10 +84,10 @@ public struct RawSpan: ~Escapable, Copyable, BitwiseCopyable {
8384
}
8485
}
8586

86-
@available(SwiftStdlib 6.1, *)
87+
@available(SwiftStdlib 5.0, *)
8788
extension RawSpan: @unchecked Sendable {}
8889

89-
@available(SwiftStdlib 6.1, *)
90+
@available(SwiftStdlib 5.0, *)
9091
extension RawSpan {
9192

9293
/// Unsafely create a `RawSpan` over initialized memory.
@@ -302,7 +303,7 @@ extension RawSpan {
302303
}
303304
}
304305

305-
@available(SwiftStdlib 6.1, *)
306+
@available(SwiftStdlib 5.0, *)
306307
extension RawSpan {
307308

308309
/// The number of bytes in the span.
@@ -331,7 +332,7 @@ extension RawSpan {
331332
}
332333

333334
// MARK: extracting sub-spans
334-
@available(SwiftStdlib 6.1, *)
335+
@available(SwiftStdlib 5.0, *)
335336
extension RawSpan {
336337

337338
/// Constructs a new span over the bytes within the supplied range of
@@ -441,7 +442,7 @@ extension RawSpan {
441442
}
442443
}
443444

444-
@available(SwiftStdlib 6.1, *)
445+
@available(SwiftStdlib 5.0, *)
445446
extension RawSpan {
446447

447448
/// Calls the given closure with a pointer to the underlying bytes of
@@ -466,7 +467,7 @@ extension RawSpan {
466467
}
467468
}
468469

469-
@available(SwiftStdlib 6.1, *)
470+
@available(SwiftStdlib 5.0, *)
470471
extension RawSpan {
471472

472473
/// View the bytes of this span as type `T`
@@ -498,7 +499,7 @@ extension RawSpan {
498499
}
499500

500501
// MARK: load
501-
@available(SwiftStdlib 6.1, *)
502+
@available(SwiftStdlib 5.0, *)
502503
extension RawSpan {
503504

504505
/// Returns a new instance of the given type, constructed from the raw memory
@@ -612,7 +613,7 @@ extension RawSpan {
612613
}
613614
}
614615

615-
@available(SwiftStdlib 6.1, *)
616+
@available(SwiftStdlib 5.0, *)
616617
extension RawSpan {
617618
/// Returns a Boolean value indicating whether two `RawSpan` instances
618619
/// refer to the same region in memory.
@@ -644,7 +645,7 @@ extension RawSpan {
644645
}
645646

646647
// MARK: prefixes and suffixes
647-
@available(SwiftStdlib 6.1, *)
648+
@available(SwiftStdlib 5.0, *)
648649
extension RawSpan {
649650

650651
/// Returns a span containing the initial bytes of this span,

stdlib/public/core/Span/Span.swift

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import Swift
2323
/// use-after-free errors. Operations on `Span` are bounds-checked,
2424
/// ensuring spcial safety and avoiding buffer overflow errors.
2525
@frozen
26-
@available(SwiftStdlib 6.1, *)
26+
@available(SwiftStdlib 5.0, *)
27+
@_originallyDefinedIn(module: "Swift", _linkerModule: "Compatibility62", SwiftStdlib 6.0)
2728
@safe
2829
public struct Span<Element: ~Copyable & ~Escapable>
2930
: ~Escapable, Copyable, BitwiseCopyable {
@@ -85,10 +86,10 @@ public struct Span<Element: ~Copyable & ~Escapable>
8586
}
8687
}
8788

88-
@available(SwiftStdlib 6.1, *)
89+
@available(SwiftStdlib 5.0, *)
8990
extension Span: @unchecked Sendable where Element: Sendable {}
9091

91-
@available(SwiftStdlib 6.1, *)
92+
@available(SwiftStdlib 5.0, *)
9293
extension Span where Element: ~Copyable {
9394

9495
/// Unsafely create a `Span` over initialized memory.
@@ -162,7 +163,7 @@ extension Span where Element: ~Copyable {
162163
}
163164
}
164165

165-
@available(SwiftStdlib 6.1, *)
166+
@available(SwiftStdlib 5.0, *)
166167
extension Span {
167168

168169
/// Unsafely create a `Span` over initialized memory.
@@ -206,7 +207,7 @@ extension Span {
206207
}
207208
}
208209

209-
@available(SwiftStdlib 6.1, *)
210+
@available(SwiftStdlib 5.0, *)
210211
extension Span where Element: BitwiseCopyable {
211212

212213
/// Unsafely create a `Span` over initialized memory.
@@ -361,7 +362,7 @@ extension Span where Element: BitwiseCopyable {
361362
}
362363
}
363364

364-
@available(SwiftStdlib 6.1, *)
365+
@available(SwiftStdlib 5.0, *)
365366
extension Span where Element: ~Copyable {
366367

367368
/// The number of elements in the span.
@@ -392,7 +393,7 @@ extension Span where Element: ~Copyable {
392393
}
393394
}
394395

395-
@available(SwiftStdlib 6.1, *)
396+
@available(SwiftStdlib 5.0, *)
396397
extension Span where Element: ~Copyable {
397398

398399
/// Accesses the element at the specified position in the `Span`.
@@ -439,7 +440,7 @@ extension Span where Element: ~Copyable {
439440
}
440441
}
441442

442-
@available(SwiftStdlib 6.1, *)
443+
@available(SwiftStdlib 5.0, *)
443444
extension Span where Element: BitwiseCopyable {
444445

445446
/// Accesses the element at the specified position in the `Span`.
@@ -480,7 +481,7 @@ extension Span where Element: BitwiseCopyable {
480481
}
481482

482483
// MARK: sub-spans
483-
@available(SwiftStdlib 6.1, *)
484+
@available(SwiftStdlib 5.0, *)
484485
extension Span where Element: ~Copyable {
485486

486487
/// Constructs a new span over the items within the supplied range of
@@ -594,7 +595,7 @@ extension Span where Element: ~Copyable {
594595
}
595596

596597
// MARK: UnsafeBufferPointer access hatch
597-
@available(SwiftStdlib 6.1, *)
598+
@available(SwiftStdlib 5.0, *)
598599
extension Span where Element: ~Copyable {
599600

600601
/// Calls a closure with a pointer to the viewed contiguous storage.
@@ -624,7 +625,7 @@ extension Span where Element: ~Copyable {
624625
}
625626
}
626627

627-
@available(SwiftStdlib 6.1, *)
628+
@available(SwiftStdlib 5.0, *)
628629
extension Span where Element: BitwiseCopyable {
629630

630631
/// Calls the given closure with a pointer to the underlying bytes of
@@ -651,7 +652,7 @@ extension Span where Element: BitwiseCopyable {
651652
}
652653
}
653654

654-
@available(SwiftStdlib 6.1, *)
655+
@available(SwiftStdlib 5.0, *)
655656
extension Span where Element: ~Copyable {
656657
/// Returns a Boolean value indicating whether two `Span` instances
657658
/// refer to the same region in memory.
@@ -684,7 +685,7 @@ extension Span where Element: ~Copyable {
684685
}
685686

686687
// MARK: prefixes and suffixes
687-
@available(SwiftStdlib 6.1, *)
688+
@available(SwiftStdlib 5.0, *)
688689
extension Span where Element: ~Copyable {
689690

690691
/// Returns a span containing the initial elements of this span,

0 commit comments

Comments
 (0)