Skip to content

Commit d9ca835

Browse files
Mark slice::swap_with_slice unstably const
1 parent 244bbfc commit d9ca835

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/slice/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3927,8 +3927,9 @@ impl<T> [T] {
39273927
///
39283928
/// [`split_at_mut`]: slice::split_at_mut
39293929
#[stable(feature = "swap_with_slice", since = "1.27.0")]
3930+
#[rustc_const_unstable(feature = "const_swap_with_slice", issue = "142204")]
39303931
#[track_caller]
3931-
pub fn swap_with_slice(&mut self, other: &mut [T]) {
3932+
pub const fn swap_with_slice(&mut self, other: &mut [T]) {
39323933
assert!(self.len() == other.len(), "destination and source slices have different lengths");
39333934
// SAFETY: `self` is valid for `self.len()` elements by definition, and `src` was
39343935
// checked to have the same length. The slices cannot overlap because

0 commit comments

Comments
 (0)