Box::from(slice): Clarify that contents are copied

A colleague mentioned that they interpreted the old text
as saying that only the pointer and the length are copied.
Add a clause so it is more clear that the pointed to contents
are also copied.
This commit is contained in:
Alan Wu 2022-07-21 13:15:29 -04:00 committed by GitHub
parent 1673f1450e
commit 321419ec42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1480,7 +1480,7 @@ impl<T: Copy> From<&[T]> for Box<[T]> {
/// Converts a `&[T]` into a `Box<[T]>`
///
/// This conversion allocates on the heap
/// and performs a copy of `slice`.
/// and performs a copy of `slice` and its contents.
///
/// # Examples
/// ```rust