-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Fix std::mem::drop rustdoc misleading statement #149244
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -898,8 +898,6 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T { | |||||
|
|
||||||
| /// Disposes of a value. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kind of goes against the original purpose of this change. Sure, This change puts the clarification that it's just an empty function body before the actual mention of [
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "letting it go out of scope" is just a bit more general and direct than saying "just an empty function body", otherwise you still need to infer that an empty function makes all its arguments go out of scope...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with @clarfonthey, I think there are a lot of ways to explain this and this is why I've decided to just do the minimal possible thing until somebody maybe from @rust-lang/libs-contributors comes and suggest a way in which they would approve the change. |
||||||
| /// | ||||||
| /// This does so by calling the argument's implementation of [`Drop`][drop]. | ||||||
| /// | ||||||
| /// This effectively does nothing for types which implement `Copy`, e.g. | ||||||
| /// integers. Such values are copied and _then_ moved into the function, so the | ||||||
| /// value persists after this function call. | ||||||
|
|
@@ -910,7 +908,7 @@ pub const fn replace<T>(dest: &mut T, src: T) -> T { | |||||
| /// pub fn drop<T>(_x: T) {} | ||||||
| /// ``` | ||||||
| /// | ||||||
| /// Because `_x` is moved into the function, it is automatically dropped before | ||||||
| /// Because `_x` is moved into the function, it is automatically [dropped][drop] before | ||||||
| /// the function returns. | ||||||
| /// | ||||||
| /// [drop]: Drop | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.