diff options
| author | Paolo Barbolini <paolo.barbolini@m4ss.net> | 2025-06-08 18:15:33 +0000 |
|---|---|---|
| committer | Paolo Barbolini <paolo.barbolini@m4ss.net> | 2025-06-08 18:16:10 +0000 |
| commit | d9ca835db4ead44eba68345f32e0e8226822440c (patch) | |
| tree | 508c666e50b5e05708921f7b16b9960c66efb465 | |
| parent | 244bbfc60ee8593db96892468eee876240cb7ba1 (diff) | |
| download | rust-d9ca835db4ead44eba68345f32e0e8226822440c.tar.gz rust-d9ca835db4ead44eba68345f32e0e8226822440c.zip | |
Mark `slice::swap_with_slice` unstably const
| -rw-r--r-- | library/core/src/slice/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 4f7e1440880..9ad3fd5cd33 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -3927,8 +3927,9 @@ impl<T> [T] { /// /// [`split_at_mut`]: slice::split_at_mut #[stable(feature = "swap_with_slice", since = "1.27.0")] + #[rustc_const_unstable(feature = "const_swap_with_slice", issue = "142204")] #[track_caller] - pub fn swap_with_slice(&mut self, other: &mut [T]) { + pub const fn swap_with_slice(&mut self, other: &mut [T]) { assert!(self.len() == other.len(), "destination and source slices have different lengths"); // SAFETY: `self` is valid for `self.len()` elements by definition, and `src` was // checked to have the same length. The slices cannot overlap because |
