Skip to content

Commit 78810bd

Browse files
committed
Add documentation to Box conversions
Part of rust-lang#51430
1 parent 6dd7fa1 commit 78810bd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/alloc/src/boxed.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,10 +1333,15 @@ impl<T: Copy> From<&[T]> for Box<[T]> {
13331333
impl<T: Copy> From<Cow<'_, [T]>> for Box<[T]> {
13341334
/// Converts a `Cow<'_, [T]>` into a `Box<[T]>`
13351335
///
1336+
<<<<<<< HEAD
13361337
/// When `cow` is the `Cow::Borrowed` variant, this
13371338
/// conversion allocates on the heap and performs a copy of the
13381339
/// underlying slice. Otherwise, it will try to re-use the owned
13391340
/// vec's allocation.
1341+
=======
1342+
/// This conversion allocates on the heap
1343+
/// and performs a copy of `s`.
1344+
>>>>>>> Add documentation to Box conversions
13401345
#[inline]
13411346
fn from(cow: Cow<'_, [T]>) -> Box<[T]> {
13421347
match cow {
@@ -1455,7 +1460,8 @@ impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]> {
14551460
///
14561461
/// # Errors
14571462
///
1458-
/// Returns the old `Box<[T]>` in the `Err` variant if `boxed_slice.len()` does not equal `N`.
1463+
/// Returns the old `Box<[T]>` in the `Err` variant if
1464+
/// `boxed_slice.len()` does not equal `N`.
14591465
fn try_from(boxed_slice: Box<[T]>) -> Result<Self, Self::Error> {
14601466
if boxed_slice.len() == N {
14611467
Ok(unsafe { Box::from_raw(Box::into_raw(boxed_slice) as *mut [T; N]) })

0 commit comments

Comments
 (0)