diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-04-11 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-04-11 00:00:00 +0000 |
| commit | 60780e438a8f99617ab709f28ab3d54d73ea4af6 (patch) | |
| tree | 622e16ea155d3523a8dda289d50ecaf0ee72c83c /library/core/src/array | |
| parent | 58f32da346642ff3f50186f6f4a0de46e61008be (diff) | |
| download | rust-60780e438a8f99617ab709f28ab3d54d73ea4af6.tar.gz rust-60780e438a8f99617ab709f28ab3d54d73ea4af6.zip | |
Remove FixedSizeArray
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 8f52985d1df..b6ce825e247 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -12,7 +12,6 @@ use crate::convert::{Infallible, TryFrom}; use crate::fmt; use crate::hash::{self, Hash}; use crate::iter::TrustedLen; -use crate::marker::Unsize; use crate::mem::{self, MaybeUninit}; use crate::ops::{Index, IndexMut}; use crate::slice::{Iter, IterMut}; @@ -36,41 +35,6 @@ pub fn from_mut<T>(s: &mut T) -> &mut [T; 1] { unsafe { &mut *(s as *mut T).cast::<[T; 1]>() } } -/// Utility trait implemented only on arrays of fixed size -/// -/// This trait can be used to implement other traits on fixed-size arrays -/// without causing much metadata bloat. -/// -/// The trait is marked unsafe in order to restrict implementors to fixed-size -/// arrays. A user of this trait can assume that implementors have the exact -/// layout in memory of a fixed size array (for example, for unsafe -/// initialization). -/// -/// Note that the traits [`AsRef`] and [`AsMut`] provide similar methods for types that -/// may not be fixed-size arrays. Implementors should prefer those traits -/// instead. -#[unstable(feature = "fixed_size_array", issue = "27778")] -pub unsafe trait FixedSizeArray<T> { - /// Converts the array to immutable slice - #[unstable(feature = "fixed_size_array", issue = "27778")] - fn as_slice(&self) -> &[T]; - /// Converts the array to mutable slice - #[unstable(feature = "fixed_size_array", issue = "27778")] - fn as_mut_slice(&mut self) -> &mut [T]; -} - -#[unstable(feature = "fixed_size_array", issue = "27778")] -unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A { - #[inline] - fn as_slice(&self) -> &[T] { - self - } - #[inline] - fn as_mut_slice(&mut self) -> &mut [T] { - self - } -} - /// The error type returned when a conversion from a slice to an array fails. #[stable(feature = "try_from", since = "1.34.0")] #[derive(Debug, Copy, Clone)] |
