-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Documentation for CStr
is not that of CString
#84000
Conversation
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
61aa43d
to
72cac1c
Compare
@eggyal , have you had time to address the most recent comments? |
Erroneous push closed PR accidentally. @rustbot label -S-waiting-on-author +S-waiting-on-review |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d16d8ca
to
053e0c7
Compare
This comment has been minimized.
This comment has been minimized.
Aaagh, sorry, I'm making a right hash of git today. |
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 don't think this change in its current form is an improvement. The original example shows the subtle mistake of using CString::new
and .as_ptr()
in the same expression, which is an easy mistake to make. The new example shows a more contrived snippet, which doesn't show as clearly how easy it is to make this mistake.
In addition, the changed documentation continues to explain a fix that doesn't just keep the right variable alive longer, but uses a completely different method of using a [u8; _]
called bytes
which the first example doesn't have, making it harder to focus on the lifetime problem itself.
@eggyal Ping from triage, any updates on this? |
@eggyal Ping from triage: I'm closing this as inactive because it hasn't moved for a month. Please feel free to reopen when you're ready to continue. |
Fixes #83999