We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 21e872c + 00c1f59 commit 2be5456Copy full SHA for 2be5456
core/src/slice/mod.rs
@@ -3974,8 +3974,9 @@ impl<T> [T] {
3974
///
3975
/// [`split_at_mut`]: slice::split_at_mut
3976
#[stable(feature = "swap_with_slice", since = "1.27.0")]
3977
+ #[rustc_const_unstable(feature = "const_swap_with_slice", issue = "142204")]
3978
#[track_caller]
- pub fn swap_with_slice(&mut self, other: &mut [T]) {
3979
+ pub const fn swap_with_slice(&mut self, other: &mut [T]) {
3980
assert!(self.len() == other.len(), "destination and source slices have different lengths");
3981
// SAFETY: `self` is valid for `self.len()` elements by definition, and `src` was
3982
// checked to have the same length. The slices cannot overlap because
0 commit comments