diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-04-12 01:04:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-12 01:04:09 +0200 |
| commit | 3ea5a9f301c6553d3c08774af2a1fd7a7e38fadc (patch) | |
| tree | 5651e3eec25da20da60d77d5d90b6a6a076250ce /library/core/src/array | |
| parent | ae549b5bb7db96f52fa8020a5ba501b2485a7f9d (diff) | |
| parent | 60780e438a8f99617ab709f28ab3d54d73ea4af6 (diff) | |
| download | rust-3ea5a9f301c6553d3c08774af2a1fd7a7e38fadc.tar.gz rust-3ea5a9f301c6553d3c08774af2a1fd7a7e38fadc.zip | |
Rollup merge of #84094 - tmiasko:remove-fixed-size-array, r=m-ou-se
Remove FixedSizeArray Remove `FixedSizeArray` trait, it has been superseded by const generics. Closes #27778.
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)] |
