Skip to content

Commit

Permalink
Box::from(slice): Clarify that contents are copied
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
XrXr committed Jul 21, 2022
1 parent 1673f14 commit 321419e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 321419e

Please sign in to comment.