@@ -2,6 +2,7 @@ use crate::simd::{
2
2
intrinsics, LaneCount , Mask , MaskElement , SimdCast , SimdCastPtr , SimdConstPtr , SimdMutPtr ,
3
3
SimdPartialOrd , SupportedLaneCount , Swizzle ,
4
4
} ;
5
+ use core:: convert:: { TryFrom , TryInto } ;
5
6
6
7
/// A SIMD vector with the shape of `[T; N]` but the operations of `T`.
7
8
///
@@ -109,7 +110,7 @@ where
109
110
T : SimdElement ,
110
111
{
111
112
/// Number of elements in this vector.
112
- pub const N : usize = N ;
113
+ pub const LANES : usize = N ;
113
114
114
115
/// Returns the number of elements in this SIMD vector.
115
116
///
@@ -122,7 +123,7 @@ where
122
123
/// assert_eq!(v.lanes(), 4);
123
124
/// ```
124
125
pub const fn lanes ( & self ) -> usize {
125
- Self :: N
126
+ Self :: LANES
126
127
}
127
128
128
129
/// Constructs a new SIMD vector with all elements set to the given value.
@@ -260,7 +261,7 @@ where
260
261
#[ must_use]
261
262
pub const fn from_slice ( slice : & [ T ] ) -> Self {
262
263
assert ! (
263
- slice. len( ) >= Self :: N ,
264
+ slice. len( ) >= Self :: LANES ,
264
265
"slice length must be at least the number of elements"
265
266
) ;
266
267
// SAFETY: We just checked that the slice contains
@@ -288,7 +289,7 @@ where
288
289
/// ```
289
290
pub fn copy_to_slice ( self , slice : & mut [ T ] ) {
290
291
assert ! (
291
- slice. len( ) >= Self :: N ,
292
+ slice. len( ) >= Self :: LANES ,
292
293
"slice length must be at least the number of elements"
293
294
) ;
294
295
// SAFETY: We just checked that the slice contains
@@ -883,7 +884,7 @@ where
883
884
{
884
885
type Error = core:: array:: TryFromSliceError ;
885
886
886
- fn try_from ( slice : & [ T ] ) -> Result < Self , Self :: Error > {
887
+ fn try_from ( slice : & [ T ] ) -> Result < Self , core :: array :: TryFromSliceError > {
887
888
Ok ( Self :: from_array ( slice. try_into ( ) ?) )
888
889
}
889
890
}
@@ -895,7 +896,7 @@ where
895
896
{
896
897
type Error = core:: array:: TryFromSliceError ;
897
898
898
- fn try_from ( slice : & mut [ T ] ) -> Result < Self , Self :: Error > {
899
+ fn try_from ( slice : & mut [ T ] ) -> Result < Self , core :: array :: TryFromSliceError > {
899
900
Ok ( Self :: from_array ( slice. try_into ( ) ?) )
900
901
}
901
902
}
0 commit comments