diff options
| author | bors <bors@rust-lang.org> | 2021-08-08 19:37:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-08 19:37:02 +0000 |
| commit | ad981d58e1ca16bcf4072577934630deb11c5e14 (patch) | |
| tree | b96b0d04083ac7a8d8bcc562d2bdb3ce9e16c5cf /library/alloc/src/vec | |
| parent | 442e627beef1c582b81b241bd862fea185937585 (diff) | |
| parent | 8ec5060cdd16c772fa9474540ccda3f95996a653 (diff) | |
| download | rust-ad981d58e1ca16bcf4072577934630deb11c5e14.tar.gz rust-ad981d58e1ca16bcf4072577934630deb11c5e14.zip | |
Auto merge of #86879 - YohDeadfall:stabilize-vec-shrink-to, r=dtolnay
Stabilize Vec<T>::shrink_to This PR stabilizes `shrink_to` feature and closes the corresponding issue. The second point was addressed already, and no `panic!` should occur. Closes #56431.
Diffstat (limited to 'library/alloc/src/vec')
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index c54c91509d4..e14ebd869a3 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -947,7 +947,6 @@ impl<T, A: Allocator> Vec<T, A> { /// # Examples /// /// ``` - /// #![feature(shrink_to)] /// let mut vec = Vec::with_capacity(10); /// vec.extend([1, 2, 3]); /// assert_eq!(vec.capacity(), 10); @@ -957,7 +956,7 @@ impl<T, A: Allocator> Vec<T, A> { /// assert!(vec.capacity() >= 3); /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "shrink_to", reason = "new API", issue = "56431")] + #[stable(feature = "shrink_to", since = "1.56.0")] pub fn shrink_to(&mut self, min_capacity: usize) { if self.capacity() > min_capacity { self.buf.shrink_to_fit(cmp::max(self.len, min_capacity)); |
