Skip to content

[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

Merged
merged 9 commits into from
Feb 2, 2024

Conversation

glessard
Copy link
Contributor

@glessard glessard commented Jan 29, 2024

@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

@glessard glessard requested a review from natecook1000 January 29, 2024 21:38
Copy link
Member

@natecook1000 natecook1000 left a 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?

@glessard
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@glessard
Copy link
Contributor Author

@swift-ci please test

@glessard
Copy link
Contributor Author

Are the specialization removals intended in this PR as well?

These were all on @_alwaysEmitIntoClient functions, so as far as I can tell they were useless.

@glessard glessard marked this pull request as ready for review January 30, 2024 12:28
@glessard glessard requested a review from a team as a code owner January 30, 2024 12:28
@glessard
Copy link
Contributor Author

glessard commented Feb 2, 2024

@swift-ci please test

@glessard glessard merged commit 0ec6397 into swiftlang:main Feb 2, 2024
@glessard glessard deleted the rdar121395821 branch February 2, 2024 20:17
grynspan added a commit to swiftlang/swift-testing that referenced this pull request Feb 5, 2024
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.
grynspan added a commit to swiftlang/swift-testing that referenced this pull request Feb 5, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants