Skip to content

[stdlib] fix some inconsistent declarations #75622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/public/core/CString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ extension String {
}

@_alwaysEmitIntoClient
private init(_checkingCString bytes: UnsafeBufferPointer<UInt8>) {
internal init(_checkingCString bytes: UnsafeBufferPointer<UInt8>) {
guard let length = bytes.firstIndex(of: 0) else {
_preconditionFailure(
"input of String.init(cString:) must be null-terminated"
Expand Down
7 changes: 4 additions & 3 deletions stdlib/public/core/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,14 @@ extension String {
// check in String(decoding:as:).
@_alwaysEmitIntoClient
@inline(never) // slow-path
private static func _fromNonContiguousUnsafeBitcastUTF8Repairing<
internal static func _fromNonContiguousUnsafeBitcastUTF8Repairing<
C: Collection
>(_ input: C) -> (result: String, repairsMade: Bool) {
_internalInvariant(C.Element.self == UInt8.self)
return Array(input).withUnsafeBufferPointer {
let raw = UnsafeRawBufferPointer($0)
return String._fromUTF8Repairing(raw.bindMemory(to: UInt8.self))
UnsafeRawBufferPointer($0).withMemoryRebound(to: UInt8.self) {
String._fromUTF8Repairing($0)
}
}
}

Expand Down