diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-08-04 11:24:35 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-04 11:24:35 +1000 |
| commit | 625b180035aa0f7a5796c1ea133f81d9f20b81ff (patch) | |
| tree | d56d6f294965c12b3b345cd64983c96699f89ced | |
| parent | 383b9c447b61641e1f1a3850253944a897a60827 (diff) | |
| parent | d9ca835db4ead44eba68345f32e0e8226822440c (diff) | |
| download | rust-625b180035aa0f7a5796c1ea133f81d9f20b81ff.tar.gz rust-625b180035aa0f7a5796c1ea133f81d9f20b81ff.zip | |
Rollup merge of #142205 - paolobarbolini:const_swap_with_slice-impl, r=Mark-Simulacrum
Mark `slice::swap_with_slice` unstably const Tracking issue rust-lang/rust#142204
| -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 14042997bc2..1dddc48e68e 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -3974,8 +3974,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 |
