Skip to content

Commit 7a0cc2f

Browse files
Merge pull request #465 from clarfonthey/const-mut
Add const to `as_mut_array`, `copy_to_slice`
2 parents 70b1c20 + 97a3a50 commit 7a0cc2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/core_simd/src/vector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ where
195195

196196
/// Returns a mutable array reference containing the entire SIMD vector.
197197
#[inline]
198-
pub fn as_mut_array(&mut self) -> &mut [T; N] {
198+
pub const fn as_mut_array(&mut self) -> &mut [T; N] {
199199
// SAFETY: `Simd<T, N>` is just an overaligned `[T; N]` with
200200
// potential padding at the end, so pointer casting to a
201201
// `&mut [T; N]` is safe.
@@ -324,7 +324,7 @@ where
324324
/// ```
325325
#[inline]
326326
#[track_caller]
327-
pub fn copy_to_slice(self, slice: &mut [T]) {
327+
pub const fn copy_to_slice(self, slice: &mut [T]) {
328328
assert!(
329329
slice.len() >= Self::LEN,
330330
"slice length must be at least the number of elements"

0 commit comments

Comments
 (0)