Skip to content

Commit e07fbd2

Browse files
committed
CompatibilitySpan: Add MutableRawSpan.swift, MutableSpan.swift
1 parent 70f9069 commit e07fbd2

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

stdlib/public/core/Span/MutableRawSpan.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if SPAN_COMPATIBILITY_STUB
14+
import Swift
15+
#endif
16+
1317
// A MutableRawSpan represents a span of memory which
1418
// contains initialized `Element` instances.
1519
@safe
@@ -338,6 +342,10 @@ extension MutableRawSpan {
338342
}
339343
}
340344

345+
// FIXME: The functions in this extension crash the SIL optimizer when built inside
346+
// the stub. But these declarations don't generate a public symbol anyway.
347+
#if !SPAN_COMPATIBILITY_STUB
348+
341349
//MARK: copyMemory
342350
@available(SwiftStdlib 6.2, *)
343351
extension MutableRawSpan {
@@ -429,6 +437,7 @@ extension MutableRawSpan {
429437
update(fromContentsOf: source.bytes)
430438
}
431439
}
440+
#endif
432441

433442
// MARK: sub-spans
434443
@available(SwiftStdlib 6.2, *)

stdlib/public/core/Span/MutableSpan.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if SPAN_COMPATIBILITY_STUB
14+
import Swift
15+
#endif
16+
1317
// A MutableSpan<Element> represents a span of memory which
1418
// contains initialized `Element` instances.
1519
@safe

stdlib/toolchain/CompatibilitySpan/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED SWIFT_STDLIB_LIBRARY_BUILD_TY
44

55
add_swift_target_library("${library_name}" ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
66
FakeStdlib.swift
7+
../../public/core/Span/MutableRawSpan.swift
8+
../../public/core/Span/MutableSpan.swift
79
../../public/core/Span/RawSpan.swift
810
../../public/core/Span/Span.swift
911

stdlib/toolchain/CompatibilitySpan/FakeStdlib.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ internal func _overrideLifetime<
5959
dependent
6060
}
6161

62+
@unsafe
63+
@_unsafeNonescapableResult
64+
@_alwaysEmitIntoClient
65+
@_transparent
66+
@lifetime(borrow source)
67+
internal func _overrideLifetime<
68+
T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable
69+
>(
70+
_ dependent: consuming T,
71+
mutating source: inout U
72+
) -> T {
73+
dependent
74+
}
75+
6276
extension Range {
6377
@_alwaysEmitIntoClient
6478
internal init(_uncheckedBounds bounds: (lower: Bound, upper: Bound)) {

0 commit comments

Comments
 (0)