Skip to content

Commit 4b9d611

Browse files
authored
[stdlib] Use nonmutating method to access _FixedArray contents on subscript (#17911)
1 parent c3b9cc8 commit 4b9d611

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

stdlib/public/core/FixedArray.swift.gyb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ extension _FixedArray${N} : RandomAccessCollection, MutableCollection {
7979
get {
8080
let count = self.count // for exclusive access
8181
_sanityCheck(i >= 0 && i < count)
82-
var copy = storage
83-
let res: T = withUnsafeBytes(of: &copy) {
82+
let res: T = withUnsafeBytes(of: storage) {
8483
(rawPtr : UnsafeRawBufferPointer) -> T in
8584
let stride = MemoryLayout<T>.stride
8685
_sanityCheck(rawPtr.count == ${N}*stride, "layout mismatch?")

0 commit comments

Comments
 (0)