about summary refs log tree commit diff
path: root/library/core/src/array
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-13 00:56:18 +0000
committerbors <bors@rust-lang.org>2021-12-13 00:56:18 +0000
commitf7fd79ac1d485ab47b62146f6dafed4aad5d9c6d (patch)
tree032613d79b9ac2f1fae24adfc2091a56b4acf64b /library/core/src/array
parent22f8bde876f2fa9c5c4e95be1bce29cc271f2b51 (diff)
parent9e662d0c0322e2f82fbd9b9e5216a9284f2b124f (diff)
downloadrust-f7fd79ac1d485ab47b62146f6dafed4aad5d9c6d.tar.gz
rust-f7fd79ac1d485ab47b62146f6dafed4aad5d9c6d.zip
Auto merge of #91841 - matthiaskrgr:rollup-zlhsg5a, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #91086 (Implement `TryFrom<&'_ mut [T]>` for `[T; N]`)
 - #91091 (Stabilize `ControlFlow::{is_break, is_continue}`)
 - #91749 (BTree: improve public descriptions and comments)
 - #91819 (rustbot: Add autolabeling for `T-compiler`)
 - #91824 (Make `(*mut T)::write_bytes` `const`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/core/src/array')
-rw-r--r--library/core/src/array/mod.rs12
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;