Skip to content

Commit dd854fa

Browse files
committed
[stdlib] use temporary rebinding as appropriate
1 parent a77b8ce commit dd854fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/public/core/String.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,9 @@ extension String {
433433
>(_ input: C) -> (result: String, repairsMade: Bool) {
434434
_internalInvariant(C.Element.self == UInt8.self)
435435
return Array(input).withUnsafeBufferPointer {
436-
let raw = UnsafeRawBufferPointer($0)
437-
return String._fromUTF8Repairing(raw.bindMemory(to: UInt8.self))
436+
UnsafeRawBufferPointer($0).withMemoryRebound(to: UInt8.self) {
437+
String._fromUTF8Repairing($0)
438+
}
438439
}
439440
}
440441

0 commit comments

Comments
 (0)