@@ -156,9 +156,9 @@ where
156156 /// assert_eq!(v.as_array(), &[0, 1, 2, 3]);
157157 /// ```
158158 pub const fn as_array ( & self ) -> & [ T ; N ] {
159- // SAFETY: Transmuting between `Simd<T, N>` and `[T; N]`
160- // is always valid and `Simd<T, N>` never has a lower alignment
161- // than ` [T; N]`.
159+ // SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
160+ // potential padding at the end, so pointer casting to a
161+ // `& [T; N]` is safe .
162162 //
163163 // NOTE: This deliberately doesn't just use `&self.0`, see the comment
164164 // on the struct definition for details.
@@ -167,9 +167,9 @@ where
167167
168168 /// Returns a mutable array reference containing the entire SIMD vector.
169169 pub fn as_mut_array ( & mut self ) -> & mut [ T ; N ] {
170- // SAFETY: Transmuting between `Simd<T, N>` and `[T; N]`
171- // is always valid and `Simd<T, N>` never has a lower alignment
172- // than ` [T; N]`.
170+ // SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
171+ // potential padding at the end, so pointer casting to a
172+ // `&mut [T; N]` is safe .
173173 //
174174 // NOTE: This deliberately doesn't just use `&mut self.0`, see the comment
175175 // on the struct definition for details.
0 commit comments