Skip to content

Commit 11aa68b

Browse files
committed
Temporarily use _read and _modify
1 parent b1ca3b7 commit 11aa68b

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

stdlib/public/core/Vector.swift

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -276,36 +276,17 @@ extension Vector where Element: ~Copyable {
276276
@_alwaysEmitIntoClient
277277
public subscript(_ i: Int) -> Element {
278278
@_transparent
279-
unsafeAddress {
279+
_read {
280280
_precondition(startIndex <= i && i < endIndex, "Index out of bounds")
281281

282-
return address + i
282+
yield ((address + i).pointee)
283283
}
284284

285285
@_transparent
286-
unsafeMutableAddress {
286+
_modify {
287287
_precondition(startIndex <= i && i < endIndex, "Index out of bounds")
288288

289-
return mutableAddress + i
290-
}
291-
}
292-
}
293-
294-
@available(SwiftStdlib 6.1, *)
295-
extension Vector where Element: Copyable {
296-
@available(SwiftStdlib 6.1, *)
297-
@_alwaysEmitIntoClient
298-
public subscript(_ i: Int) -> Element {
299-
get {
300-
_precondition(startIndex <= i && i < endIndex, "Index out of bounds")
301-
302-
return buffer[i]
303-
}
304-
305-
set {
306-
_precondition(startIndex <= i && i < endIndex, "Index out of bounds")
307-
308-
mutableBuffer[i] = newValue
289+
yield &(mutableAddress + i).pointee
309290
}
310291
}
311292
}

0 commit comments

Comments
 (0)