Skip to content

Commit 172e1e8

Browse files
committed
---
yaml --- r: 157572 b: refs/heads/snap-stage3 c: 58dc0a0 h: refs/heads/master v: v3
1 parent 2ed8e5b commit 172e1e8

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 065caf34f5ff29e04605f95d9c5d511af219439a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1da73ff12642182c9049630c3625f44f718c6c2f
4+
refs/heads/snap-stage3: 58dc0a05abb98ae2db65ca20e70f3bab51f8bf92
55
refs/heads/try: 0ee4d8b0b112c608646fa75463ab4dc59132efd9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,18 @@ impl<T> Vec<T> {
636636
}
637637
}
638638

639-
/// Shrinks the capacity of the vector as much as possible.
639+
/// Shrinks the capacity of the vector as much as possible. It will drop
640+
/// down as close as possible to the length but the allocator may still
641+
/// inform the vector that there is space for a few more elements.
640642
///
641643
/// # Example
642644
///
643645
/// ```
644-
/// let mut vec = vec![1i, 2, 3];
646+
/// let mut vec: Vec<int> = Vec::with_capacity(10);
647+
/// vec.push_all([1, 2, 3]);
648+
/// assert_eq!(vec.capacity(), 10);
645649
/// vec.shrink_to_fit();
650+
/// assert!(vec.capacity() >= 3);
646651
/// ```
647652
#[stable]
648653
pub fn shrink_to_fit(&mut self) {
@@ -830,6 +835,7 @@ impl<T> Vec<T> {
830835
/// for num in vec.iter_mut() {
831836
/// *num = 0;
832837
/// }
838+
/// assert_eq!(vec, vec![0i, 0, 0]);
833839
/// ```
834840
#[inline]
835841
pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a,T> {

0 commit comments

Comments
 (0)