Skip to content

Commit 0c130a9

Browse files
committed
Make test robust against strict memory safety changes to the standard library
1 parent 998dea2 commit 0c130a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/Unsafe/safe.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ struct MyArray<Element> {
185185
}
186186

187187
extension UnsafeBufferPointer {
188-
@safe var safeCount: Int { unsafe count }
188+
@unsafe var unsafeCount: Int { 17 }
189+
@safe var safeCount: Int { unsafe unsafeCount }
189190
}
190191

191192
func testMyArray(ints: MyArray<Int>) {
@@ -194,6 +195,6 @@ func testMyArray(ints: MyArray<Int>) {
194195
_ = unsafe bufferCopy
195196

196197
print(buffer.safeCount)
197-
unsafe print(buffer.baseAddress!)
198+
unsafe print(buffer.unsafeCount)
198199
}
199200
}

0 commit comments

Comments
 (0)