-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Improve the safety docs for CStr
#95948
Conversation
Thank you for submitting a new PR for the library teams! If this PR contains a stabilization of a library feature that has not already completed FCP in its tracking issue, introduces new or changes existing unstable library APIs, or changes our public documentation in ways that create new stability guarantees then please comment with |
(rust-highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #94079) made this pull request unmergeable. Please resolve the merge conflicts. |
f797770
to
6bbf4c0
Compare
Fixed the merge conflict related to |
r? @RalfJung maybe? I assume you're familiar with that area. If not feel free to re-assign! |
6bbf4c0
to
2c64175
Compare
@rustbot ready |
Thank you for the review, I've implemented the suggestions! |
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.
Thanks for the edits!
However, this still reads quite different from https://doc.rust-lang.org/nightly/std/slice/fn.from_raw_parts.html, doesn't it?
2c64175
to
72e2f2d
Compare
I applied your suggestions and also added the |
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.
I like it, thanks. :) Just some last nits, then we are done.
72e2f2d
to
cc2a30f
Compare
@RalfJung I think it should be ready now :) |
Thanks for the ping; GH doesn't always send notifications for force pushes so I did not realize this is ready for review again. |
However, the 3 nits that I posted are all still open I think? |
Huh, that's weird, I remember fixing those. Anyways, I'm quickly gonna fix them. |
Namely, the two functions `from_ptr` and `from_bytes_with_nul_unchecked`. Before, this functions didn't state the requirements clearly enough, and I was not immediately able to find them like for other functions. This doesn't change the content of the docs, but simply rewords them for clarity.
cc2a30f
to
0dda42b
Compare
And fixed it. |
Thanks. :) |
📌 Commit 0dda42b has been approved by |
… r=RalfJung Improve the safety docs for `CStr` Namely, the two functions `from_ptr` and `from_bytes_with_nul_unchecked`. Before, these functions didn't state the requirements clearly enough, and I was not immediately able to find them like for other functions. This doesn't change the content of the docs, but simply rewords them for clarity. note: I'm not entirely sure about the '`ptr` must be valid for reads of `u8`.', there might be room for improvement for this (and maybe for the other docs as well 😄)
Rollup of 5 pull requests Successful merges: - rust-lang#95948 (Improve the safety docs for `CStr`) - rust-lang#97325 (Fix precise field capture of univariant enums) - rust-lang#97817 (:arrow_up: rust-analyzer) - rust-lang#97821 (Remove confusing sentence from `Mutex` docs) - rust-lang#97826 (Add more information for rustdoc-gui tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Namely, the two functions
from_ptr
andfrom_bytes_with_nul_unchecked
.Before, these functions didn't state the requirements clearly enough,
and I was not immediately able to find them like for other functions.
This doesn't change the content of the docs, but simply rewords them for
clarity.
note: I'm not entirely sure about the '
ptr
must be valid for reads ofu8
.', there might be room for improvement for this (and maybe for the other docs as well 😄)