@@ -12,7 +12,6 @@ use crate::convert::{Infallible, TryFrom};
1212use crate :: fmt;
1313use crate :: hash:: { self , Hash } ;
1414use crate :: iter:: TrustedLen ;
15- use crate :: marker:: Unsize ;
1615use crate :: mem:: { self , MaybeUninit } ;
1716use crate :: ops:: { Index , IndexMut } ;
1817use crate :: slice:: { Iter , IterMut } ;
@@ -36,41 +35,6 @@ pub fn from_mut<T>(s: &mut T) -> &mut [T; 1] {
3635 unsafe { & mut * ( s as * mut T ) . cast :: < [ T ; 1 ] > ( ) }
3736}
3837
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-
7438/// The error type returned when a conversion from a slice to an array fails.
7539#[ stable( feature = "try_from" , since = "1.34.0" ) ]
7640#[ derive( Debug , Copy , Clone ) ]
0 commit comments