-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Improve documentation for the various "String from C-string" initializers #71224
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Are the specialization removals intended in this PR as well?
@swift-ci please test |
1 similar comment
@swift-ci please test |
These were all on |
These functions were the odd ones out in not using `encoding` for this parameter label. Harmonizing this term will also make the documentation more consistent.
b43a446
to
e10899e
Compare
@swift-ci please test |
The overload of `String.init(validatingUTF8:)` that takes an array of `CChar` values rather than a pointer is not really meant to be used. The overload exists for the benefit of the type checker so that future compilers can warn when a developer misuses the implicit array-to-pointer conversion. This PR changes our wrapper around `sysctlbyname()` to avoid producing a temporary `[CChar]`, thus dodging the problem. See also swiftlang/swift#71224. Resolves rdar://122198850.
The overload of `String.init(validatingUTF8:)` that takes an array of `CChar` values rather than a pointer is not really meant to be used. The overload exists for the benefit of the type checker so that future compilers can warn when a developer misuses the implicit array-to-pointer conversion. This PR changes our wrapper around `sysctlbyname()` to avoid producing a temporary `[CChar]`, thus dodging the problem. See also swiftlang/swift#71224. Resolves rdar://122198850.
@natecook1000 pointed out missing documentation in #68423 (comment)
This PR adds doc-comments to the
Array
-taking overloads of the C-string conversion initializers. In the cases where there is a more appropriate Swift spelling, they are now deprecated in Swift 6, with a message pointing to the better alternative both in the deprecation declaration and in the doc-comment.Other minor wording improvements included.
Addresses rdar://121395821