Skip to content

Commit aa9e76e

Browse files
committed
Add doc comment to Vec::clone
1 parent 6368fd5 commit aa9e76e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

library/alloc/src/vec/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,6 +3810,11 @@ unsafe impl<T, A: Allocator> ops::DerefPure for Vec<T, A> {}
38103810
#[cfg(not(no_global_oom_handling))]
38113811
#[stable(feature = "rust1", since = "1.0.0")]
38123812
impl<T: Clone, A: Allocator + Clone> Clone for Vec<T, A> {
3813+
/// Creates a new `Vec` by deep-copying the contents of an existing `Vec`.
3814+
///
3815+
/// This method will allocate a new `Vec` and `clone` all of `self`'s contents
3816+
/// into it. The capacity of the duplicate `Vec` is not forced to match the
3817+
/// capacity of the original.
38133818
fn clone(&self) -> Self {
38143819
let alloc = self.allocator().clone();
38153820
<[T]>::to_vec_in(&**self, alloc)

0 commit comments

Comments
 (0)