-
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
Improve {String,Vec}::from_raw_parts documentation #34884
Conversation
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -701,6 +701,13 @@ impl String { | |||
/// Violating these may cause problems like corrupting the allocator's | |||
/// internal datastructures. | |||
/// | |||
/// The ownership of `ptr` is effectively transferred to the | |||
/// `String` and the memory referred to by the pointer will be | |||
/// deallocated when the `String` goes out of scope. Ensure that |
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.
Should say “dropped” instead “goes out of scope”. Going out of scope does not necessarily imply the drop (we do not guarantee that, for example) and its the dropping which handles the deallocation.
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.
Done.
5eb8a74
to
66e610f
Compare
/// deallocated when the `String` is dropped. Ensure that | ||
/// nothing else uses the pointer after calling this | ||
/// function. Calling this function multiple times with the same | ||
/// pointer is an error. |
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.
Github overzealously hid the unresolved previous conversation
66e610f
to
661187a
Compare
Seems good to me. r=me. |
Oh, eh, I wonder whether the added paragraph is best under the |
After discussion on IRC: @bors: r=nagisa rollup Thanks @shepmaster! |
📌 Commit 661187a has been approved by |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 661187a has been approved by |
…agisa Improve {String,Vec}::from_raw_parts documentation
No description provided.