Skip to content

Commit 6be10de

Browse files
committed
Revert "Implement Index[Mut] for arrays"
This reverts commit c03dfa6. The commit broke code that worked on stable and beta: const fn foo() { let mut array = [[0; 1]; 1]; array[0][0] = 1; } But this was not noticed until the commit landed. Fixes rust-lang#79152
1 parent 3479fc6 commit 6be10de

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

library/core/src/array/mod.rs

-25
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::convert::{Infallible, TryFrom};
1212
use crate::fmt;
1313
use crate::hash::{self, Hash};
1414
use crate::marker::Unsize;
15-
use crate::ops::{Index, IndexMut};
1615
use crate::slice::{Iter, IterMut};
1716

1817
mod iter;
@@ -209,30 +208,6 @@ impl<'a, T, const N: usize> IntoIterator for &'a mut [T; N] {
209208
}
210209
}
211210

212-
#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
213-
impl<T, I, const N: usize> Index<I> for [T; N]
214-
where
215-
[T]: Index<I>,
216-
{
217-
type Output = <[T] as Index<I>>::Output;
218-
219-
#[inline]
220-
fn index(&self, index: I) -> &Self::Output {
221-
Index::index(self as &[T], index)
222-
}
223-
}
224-
225-
#[stable(feature = "index_trait_on_arrays", since = "1.50.0")]
226-
impl<T, I, const N: usize> IndexMut<I> for [T; N]
227-
where
228-
[T]: IndexMut<I>,
229-
{
230-
#[inline]
231-
fn index_mut(&mut self, index: I) -> &mut Self::Output {
232-
IndexMut::index_mut(self as &mut [T], index)
233-
}
234-
}
235-
236211
#[stable(feature = "rust1", since = "1.0.0")]
237212
impl<A, B, const N: usize> PartialEq<[B; N]> for [A; N]
238213
where

0 commit comments

Comments
 (0)