-
Notifications
You must be signed in to change notification settings - Fork 13.3k
improve docs for std::mem::replace #50657
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
Comments
Another option, which I think is the best of both worlds:
The important points are to mention that |
I like the third option the most:
|
@CAD97 I have to say I like yours the best. Maybe change "Moves |
opened a pr #51124 |
…isdreavus Reword {ptr,mem}::replace docs. Fixes rust-lang#50657.
I came across this reddit comment. This is a "safe" feature of rust I didn't know about.
I was at first confused about the docs for
std::mem::replace
however. My main confusion was around the "deinitializing" word which made me think thatT
is not consumed. It is consumed but it is not dropped, which is a subtle distinction. I propose here to remove the confusing language.Current docs
Suggested new docs:
Another possible option (I don't like it as much but it is more similar to the previous docs):
As a side note, I have not seen the "deinitialized" qualifier in rust before. I don't think it is part of the standard rust lingo which is probably some of my confusion 😄
The text was updated successfully, but these errors were encountered: