Skip to content

Commit 669b58e

Browse files
authored
Merge pull request #82517 from glessard/rdar153219174-followup-abi-cleanup
[stdilb] improve `mutableSpan` accessor declarations
2 parents b58b6cc + 67f3e2c commit 669b58e

File tree

8 files changed

+14
-28
lines changed

8 files changed

+14
-28
lines changed

stdlib/public/core/Array.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,9 +1744,9 @@ extension Array {
17441744
}
17451745

17461746
@available(SwiftStdlib 6.2, *)
1747+
@_alwaysEmitIntoClient
17471748
public var mutableSpan: MutableSpan<Element> {
17481749
@lifetime(&self)
1749-
@_alwaysEmitIntoClient
17501750
mutating get {
17511751
// _makeMutableAndUnique*() inserts begin_cow_mutation.
17521752
// LifetimeDependence analysis inserts call to end_cow_mutation_addr since we cannot schedule it in the stdlib for mutableSpan property.

stdlib/public/core/ArraySlice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,9 +1301,9 @@ extension ArraySlice {
13011301
}
13021302

13031303
@available(SwiftStdlib 6.2, *)
1304+
@_alwaysEmitIntoClient
13041305
public var mutableSpan: MutableSpan<Element> {
13051306
@lifetime(&self)
1306-
@_alwaysEmitIntoClient
13071307
mutating get {
13081308
// _makeMutableAndUnique*() inserts begin_cow_mutation.
13091309
// LifetimeDependence analysis inserts call to end_cow_mutation_addr since we cannot schedule it in the stdlib for mutableSpan property.

stdlib/public/core/CollectionOfOne.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ extension CollectionOfOne {
173173
}
174174

175175
@available(SwiftStdlib 6.2, *)
176+
@_alwaysEmitIntoClient
176177
public var mutableSpan: MutableSpan<Element> {
177178
@lifetime(&self)
178-
@_alwaysEmitIntoClient
179179
mutating get {
180180
let pointer = unsafe UnsafeMutablePointer<Element>(
181181
Builtin.addressOfBorrow(self)

stdlib/public/core/ContiguousArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,9 +1243,9 @@ extension ContiguousArray {
12431243
}
12441244

12451245
@available(SwiftStdlib 6.2, *)
1246+
@_alwaysEmitIntoClient
12461247
public var mutableSpan: MutableSpan<Element> {
12471248
@lifetime(&self)
1248-
@_alwaysEmitIntoClient
12491249
mutating get {
12501250
// _makeMutableAndUnique*() inserts begin_cow_mutation.
12511251
// LifetimeDependence analysis inserts call to end_cow_mutation_addr since we cannot schedule it in the stdlib for mutableSpan property.

stdlib/public/core/UnsafeBufferPointer.swift.gyb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,21 +575,22 @@ extension Unsafe${Mutable}BufferPointer where Element: ~Copyable {
575575

576576
@unsafe
577577
@available(SwiftStdlib 6.2, *)
578+
@_alwaysEmitIntoClient
578579
public var span: Span<Element> {
579580
@lifetime(borrow self)
580-
@_alwaysEmitIntoClient
581+
@_transparent
581582
get {
582-
let span = unsafe Span(_unsafeElements: self)
583-
return unsafe _overrideLifetime(span, borrowing: self)
583+
unsafe Span(_unsafeElements: self)
584584
}
585585
}
586586
%if Mutable:
587587

588588
@unsafe
589589
@available(SwiftStdlib 6.2, *)
590+
@_alwaysEmitIntoClient
590591
public var mutableSpan: MutableSpan<Element> {
591592
@lifetime(borrow self)
592-
@_alwaysEmitIntoClient
593+
@_transparent
593594
get {
594595
unsafe MutableSpan(_unsafeElements: self)
595596
}

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,9 +1164,10 @@ extension Unsafe${Mutable}RawBufferPointer {
11641164

11651165
@unsafe
11661166
@available(SwiftStdlib 6.2, *)
1167+
@_alwaysEmitIntoClient
11671168
public var mutableBytes: MutableRawSpan {
11681169
@lifetime(borrow self)
1169-
@_alwaysEmitIntoClient
1170+
@_transparent
11701171
get {
11711172
unsafe MutableRawSpan(_unsafeBytes: self)
11721173
}
@@ -1184,12 +1185,12 @@ extension Unsafe${Mutable}RawBufferPointer {
11841185

11851186
@unsafe
11861187
@available(SwiftStdlib 6.2, *)
1188+
@_alwaysEmitIntoClient
11871189
public var bytes: RawSpan {
11881190
@lifetime(borrow self)
1189-
@_alwaysEmitIntoClient
1191+
@_transparent
11901192
get {
1191-
let span = unsafe RawSpan(_unsafeBytes: self)
1192-
return unsafe _overrideLifetime(span, borrowing: self)
1193+
unsafe RawSpan(_unsafeBytes: self)
11931194
}
11941195
}
11951196
}

test/abi/macOS/arm64/stdlib.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -928,14 +928,6 @@ Added: _$ss14MutableRawSpanVN
928928
Added: _$sSS8UTF8ViewV4spans4SpanVys5UInt8VGvg
929929
Added: _$sSs8UTF8ViewV4spans4SpanVys5UInt8VGvg
930930

931-
// SE-0467 mutableSpan properties
932-
Added: _$sSa11mutableSpans07MutableB0VyxGvr
933-
Added: _$ss10ArraySliceV11mutableSpans07MutableD0VyxGvr
934-
Added: _$ss15ContiguousArrayV11mutableSpans07MutableD0VyxGvr
935-
Added: _$ss15CollectionOfOneV11mutableSpans07MutableE0VyxGvr
936-
Added: _$sSrsRi_zrlE11mutableSpans07MutableB0VyxGvr
937-
Added: _$sSw12mutableBytess14MutableRawSpanVvr
938-
939931
// _SwiftifyInfo enum for _SwiftifyImports macro
940932
Added: _$ss13_SwiftifyExprO5paramyABSicABmFWC
941933
Added: _$ss13_SwiftifyExprO6returnyA2BmFWC

test/abi/macOS/x86_64/stdlib.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -929,14 +929,6 @@ Added: _$ss14MutableRawSpanVN
929929
Added: _$sSS8UTF8ViewV4spans4SpanVys5UInt8VGvg
930930
Added: _$sSs8UTF8ViewV4spans4SpanVys5UInt8VGvg
931931

932-
// SE-0467 mutableSpan properties
933-
Added: _$sSa11mutableSpans07MutableB0VyxGvr
934-
Added: _$ss10ArraySliceV11mutableSpans07MutableD0VyxGvr
935-
Added: _$ss15ContiguousArrayV11mutableSpans07MutableD0VyxGvr
936-
Added: _$ss15CollectionOfOneV11mutableSpans07MutableE0VyxGvr
937-
Added: _$sSrsRi_zrlE11mutableSpans07MutableB0VyxGvr
938-
Added: _$sSw12mutableBytess14MutableRawSpanVvr
939-
940932
// _SwiftifyInfo enum for _SwiftifyImports macro
941933
Added: _$ss13_SwiftifyExprO5paramyABSicABmFWC
942934
Added: _$ss13_SwiftifyExprO6returnyA2BmFWC

0 commit comments

Comments
 (0)