Skip to content

Commit

Permalink
remove LengthAtMost32 on AsRef/Borrow impl for array
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Jul 4, 2020
1 parent f844ea1 commit 7d4a92d
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/libcore/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,42 +92,30 @@ impl From<Infallible> for TryFromSliceError {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T, const N: usize> AsRef<[T]> for [T; N]
where
[T; N]: LengthAtMost32,
{
impl<T, const N: usize> AsRef<[T]> for [T; N] {
#[inline]
fn as_ref(&self) -> &[T] {
&self[..]
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T, const N: usize> AsMut<[T]> for [T; N]
where
[T; N]: LengthAtMost32,
{
impl<T, const N: usize> AsMut<[T]> for [T; N] {
#[inline]
fn as_mut(&mut self) -> &mut [T] {
&mut self[..]
}
}

#[stable(feature = "array_borrow", since = "1.4.0")]
impl<T, const N: usize> Borrow<[T]> for [T; N]
where
[T; N]: LengthAtMost32,
{
impl<T, const N: usize> Borrow<[T]> for [T; N] {
fn borrow(&self) -> &[T] {
self
}
}

#[stable(feature = "array_borrow", since = "1.4.0")]
impl<T, const N: usize> BorrowMut<[T]> for [T; N]
where
[T; N]: LengthAtMost32,
{
impl<T, const N: usize> BorrowMut<[T]> for [T; N] {
fn borrow_mut(&mut self) -> &mut [T] {
self
}
Expand Down

0 comments on commit 7d4a92d

Please sign in to comment.