From 4654a910018cf0447db1edb2a46a0cae5f7dff8e Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sun, 6 Mar 2022 14:00:12 +1100 Subject: Constify slice index for strings --- library/core/src/array/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'library/core/src/array') diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index ee79021ed53..20dfbc6347c 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -276,9 +276,10 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] { } #[stable(feature = "index_trait_on_arrays", since = "1.50.0")] -impl Index for [T; N] +#[rustc_const_unstable(feature = "const_slice_index", issue = "none")] +impl const Index for [T; N] where - [T]: Index, + [T]: ~const Index, { type Output = <[T] as Index>::Output; @@ -289,9 +290,10 @@ where } #[stable(feature = "index_trait_on_arrays", since = "1.50.0")] -impl IndexMut for [T; N] +#[rustc_const_unstable(feature = "const_slice_index", issue = "none")] +impl const IndexMut for [T; N] where - [T]: IndexMut, + [T]: ~const IndexMut, { #[inline] fn index_mut(&mut self, index: I) -> &mut Self::Output { -- cgit 1.4.1-3-g733a5