diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-07-11 09:24:42 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-07-15 08:27:15 +0000 |
| commit | 2b4ede7e3d37de731821b5b04a6f1fce269c1afb (patch) | |
| tree | 4c4c7f29648eba79b916e7cdf432ca3d0099ded7 /library/core/src/array | |
| parent | cb7d52f6430922b5ffd29073f6605b19b80e7f36 (diff) | |
constify `Index` trait and its slice impls
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 16356f749c9..62203e132b7 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -374,9 +374,10 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] { } #[stable(feature = "index_trait_on_arrays", since = "1.50.0")] -impl<T, I, const N: usize> Index<I> for [T; N] +#[rustc_const_unstable(feature = "const_index", issue = "143775")] +impl<T, I, const N: usize> const Index<I> for [T; N] where - [T]: Index<I>, + [T]: ~const Index<I>, { type Output = <[T] as Index<I>>::Output; @@ -387,9 +388,10 @@ where } #[stable(feature = "index_trait_on_arrays", since = "1.50.0")] -impl<T, I, const N: usize> IndexMut<I> for [T; N] +#[rustc_const_unstable(feature = "const_index", issue = "143775")] +impl<T, I, const N: usize> const IndexMut<I> for [T; N] where - [T]: IndexMut<I>, + [T]: ~const IndexMut<I>, { #[inline] fn index_mut(&mut self, index: I) -> &mut Self::Output { |
