diff options
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 0e33e95271e..37292bf8e26 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -189,6 +189,18 @@ where } } +#[stable(feature = "try_from_mut_slice_to_array", since = "1.59.0")] +impl<T, const N: usize> TryFrom<&mut [T]> for [T; N] +where + T: Copy, +{ + type Error = TryFromSliceError; + + fn try_from(slice: &mut [T]) -> Result<[T; N], TryFromSliceError> { + <Self>::try_from(&*slice) + } +} + #[stable(feature = "try_from", since = "1.34.0")] impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N] { type Error = TryFromSliceError; |
