@@ -23,7 +23,8 @@ macro_rules! simd_ty {
2323 }
2424 // FIXME: Workaround rust@60637
2525 #[ inline( always) ]
26- pub ( crate ) fn splat( value: $elem_type) -> Self {
26+ #[ rustc_const_unstable( feature = "stdarch_const_intrinsics" , issue = "none" ) ]
27+ pub ( crate ) const fn splat( value: $elem_type) -> Self {
2728 #[ derive( Copy , Clone ) ]
2829 #[ repr( simd) ]
2930 struct JustOne ( [ $elem_type; 1 ] ) ;
@@ -38,12 +39,12 @@ macro_rules! simd_ty {
3839 /// Use for testing only.
3940 // FIXME: Workaround rust@60637
4041 #[ inline( always) ]
41- pub ( crate ) fn extract( & self , index: usize ) -> $elem_type {
42+ pub ( crate ) const fn extract( & self , index: usize ) -> $elem_type {
4243 self . as_array( ) [ index]
4344 }
4445
4546 #[ inline]
46- pub ( crate ) fn as_array( & self ) -> & [ $elem_type; $len] {
47+ pub ( crate ) const fn as_array( & self ) -> & [ $elem_type; $len] {
4748 let simd_ptr: * const Self = self ;
4849 let array_ptr: * const [ $elem_type; $len] = simd_ptr. cast( ) ;
4950 // SAFETY: We can always read the prefix of a simd type as an array.
@@ -89,7 +90,8 @@ macro_rules! simd_m_ty {
8990
9091 // FIXME: Workaround rust@60637
9192 #[ inline( always) ]
92- pub ( crate ) fn splat( value: bool ) -> Self {
93+ #[ rustc_const_unstable( feature = "stdarch_const_intrinsics" , issue = "none" ) ]
94+ pub ( crate ) const fn splat( value: bool ) -> Self {
9395 #[ derive( Copy , Clone ) ]
9496 #[ repr( simd) ]
9597 struct JustOne ( [ $elem_type; 1 ] ) ;
@@ -100,7 +102,7 @@ macro_rules! simd_m_ty {
100102 }
101103
102104 #[ inline]
103- pub ( crate ) fn as_array( & self ) -> & [ $elem_type; $len] {
105+ pub ( crate ) const fn as_array( & self ) -> & [ $elem_type; $len] {
104106 let simd_ptr: * const Self = self ;
105107 let array_ptr: * const [ $elem_type; $len] = simd_ptr. cast( ) ;
106108 // SAFETY: We can always read the prefix of a simd type as an array.
0 commit comments