diff options
| author | bors <bors@rust-lang.org> | 2021-04-12 00:38:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-12 00:38:20 +0000 |
| commit | e41f378f825488a537b024fc3ed599d9c12fda96 (patch) | |
| tree | b9d939abd2fa4e173de4c8d45d02e7c8d3033a52 /library/core/src/array | |
| parent | 3f8added7003120582953d4f3f43991fb3bb2798 (diff) | |
| parent | 1ff117e987be82e9cff59350fd1810ebe21f8b26 (diff) | |
| download | rust-e41f378f825488a537b024fc3ed599d9c12fda96.tar.gz rust-e41f378f825488a537b024fc3ed599d9c12fda96.zip | |
Auto merge of #84112 - Dylan-DPC:rollup-tapsrzz, r=Dylan-DPC
Rollup of 7 pull requests Successful merges: - #83669 (Issue 81508 fix) - #84014 (Improve trait/impl method discrepancy errors) - #84059 (Bump libc dependency of std to 0.2.93) - #84067 (clean up example on read_to_string) - #84079 (Improve test for `rustdoc::bare_urls` lint) - #84094 (Remove FixedSizeArray) - #84101 (rustdoc: Move crate loader to collect_intra_doc_links::early ) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
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)] |
