-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
improve docs for std::mem::replace #50657
Copy link
Copy link
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and tools
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and tools
Type
Fields
Give feedbackNo fields configured for issues without a type.
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::replacehowever. My main confusion was around the "deinitializing" word which made me think thatTis 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 😄