Skip to content

Commit 3f71bb8

Browse files
authored
Merge pull request #29121 from eeckstein/fix-array-remove
stdlib: annotate Array's remove functions with semantic attributes.
2 parents 6209c97 + dfc5b06 commit 3f71bb8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

stdlib/public/core/Array.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ extension Array: RangeReplaceableCollection {
12581258
}
12591259

12601260
@inlinable
1261+
@_semantics("array.mutate_unknown")
12611262
public mutating func _customRemoveLast() -> Element? {
12621263
_makeMutableAndUnique()
12631264
let newCount = _getCount() - 1
@@ -1285,6 +1286,7 @@ extension Array: RangeReplaceableCollection {
12851286
/// - Complexity: O(*n*), where *n* is the length of the array.
12861287
@inlinable
12871288
@discardableResult
1289+
@_semantics("array.mutate_unknown")
12881290
public mutating func remove(at index: Int) -> Element {
12891291
_makeMutableAndUnique()
12901292
let currentCount = _getCount()

stdlib/public/core/ContiguousArray.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ extension ContiguousArray: RangeReplaceableCollection {
890890
}
891891

892892
@inlinable
893+
@_semantics("array.mutate_unknown")
893894
public mutating func _customRemoveLast() -> Element? {
894895
_makeMutableAndUnique()
895896
let newCount = _getCount() - 1
@@ -917,6 +918,7 @@ extension ContiguousArray: RangeReplaceableCollection {
917918
/// - Complexity: O(*n*), where *n* is the length of the array.
918919
@inlinable
919920
@discardableResult
921+
@_semantics("array.mutate_unknown")
920922
public mutating func remove(at index: Int) -> Element {
921923
_makeMutableAndUnique()
922924
let currentCount = _getCount()

0 commit comments

Comments
 (0)