-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rewrite/expand doc examples for Vec::set_len
.
#34911
Conversation
@@ -532,9 +532,33 @@ impl<T> Vec<T> { | |||
/// # Examples | |||
/// | |||
/// ``` | |||
/// let mut v = vec![1, 2, 3, 4]; | |||
/// use std::ptr::drop_in_place; |
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.
idiom is to import the module, so just std::ptr
...
I have a bunch of teeny nitpicks, but this is great! Thanks so much. r=me after they're fixed |
231227b
to
102419a
Compare
Comments have been addressed. Thanks for the review! |
@bors: r+ rollup thanks so much!!! |
📌 Commit 102419a has been approved by |
|
Changes made: @@ -538,7 +554,7 @@ impl<T> Vec<T> {
///
/// unsafe {
/// ptr::drop_in_place(&mut vec[3]);
- /// v.set_len(3);
+ /// vec.set_len(3);
/// }
/// assert_eq!(vec, ['r', 'u', 's']);
/// ``` @@ -559,7 +575,7 @@ impl<T> Vec<T> {
/// values of unallocated memory:
///
/// ```
- /// let mut vec = Vec::new();
+ /// let mut vec: Vec<char> = Vec::new();
///
/// unsafe {
/// vec.set_len(4); |
ah, nice catch. @bors: r+ rollup |
📌 Commit a005b2c has been approved by |
⌛ Testing commit a005b2c with merge afaaf4b... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
@bors: retry On Tue, Jul 19, 2016 at 10:01 PM, bors notifications@github.com wrote:
|
⌛ Testing commit a005b2c with merge 3dcdb53... |
💔 Test failed - auto-linux-64-cargotest |
@bors: retry On Wed, Jul 20, 2016 at 6:27 PM, bors notifications@github.com wrote:
|
Rewrite/expand doc examples for `Vec::set_len`. None
Example was written in rust-lang#34911 Issue was brought up in this comment: rust-lang@a005b2c#commitcomment-18346958
…=nagisa Fix incorrect 'memory leak' example for `Vec::set_len`. Example was written in rust-lang#34911 Issue was brought up in this comment: rust-lang@a005b2c#commitcomment-18346958
No description provided.