@@ -12,7 +12,6 @@ use crate::convert::{Infallible, TryFrom};
12
12
use crate::fmt;
13
13
use crate::hash::{self, Hash};
14
14
use crate::iter::TrustedLen;
15
- use crate::marker::Unsize;
16
15
use crate::mem::{self, MaybeUninit};
17
16
use crate::ops::{Index, IndexMut};
18
17
use crate::slice::{Iter, IterMut};
@@ -36,41 +35,6 @@ pub fn from_mut<T>(s: &mut T) -> &mut [T; 1] {
36
35
unsafe { &mut *(s as *mut T).cast::<[T; 1]>() }
37
36
}
38
37
39
- /// Utility trait implemented only on arrays of fixed size
40
- ///
41
- /// This trait can be used to implement other traits on fixed-size arrays
42
- /// without causing much metadata bloat.
43
- ///
44
- /// The trait is marked unsafe in order to restrict implementors to fixed-size
45
- /// arrays. A user of this trait can assume that implementors have the exact
46
- /// layout in memory of a fixed size array (for example, for unsafe
47
- /// initialization).
48
- ///
49
- /// Note that the traits [`AsRef`] and [`AsMut`] provide similar methods for types that
50
- /// may not be fixed-size arrays. Implementors should prefer those traits
51
- /// instead.
52
- #[unstable(feature = "fixed_size_array", issue = "27778")]
53
- pub unsafe trait FixedSizeArray<T> {
54
- /// Converts the array to immutable slice
55
- #[unstable(feature = "fixed_size_array", issue = "27778")]
56
- fn as_slice(&self) -> &[T];
57
- /// Converts the array to mutable slice
58
- #[unstable(feature = "fixed_size_array", issue = "27778")]
59
- fn as_mut_slice(&mut self) -> &mut [T];
60
- }
61
-
62
- #[unstable(feature = "fixed_size_array", issue = "27778")]
63
- unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
64
- #[inline]
65
- fn as_slice(&self) -> &[T] {
66
- self
67
- }
68
- #[inline]
69
- fn as_mut_slice(&mut self) -> &mut [T] {
70
- self
71
- }
72
- }
73
-
74
38
/// The error type returned when a conversion from a slice to an array fails.
75
39
#[stable(feature = "try_from", since = "1.34.0")]
76
40
#[derive(Debug, Copy, Clone)]
0 commit comments