@@ -987,8 +987,9 @@ impl<T> [T] {
987987 /// assert!(v == [3, 2, 1]);
988988 /// ```
989989 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
990+ #[ rustc_const_unstable( feature = "const_slice_reverse" , issue = "135120" ) ]
990991 #[ inline]
991- pub fn reverse ( & mut self ) {
992+ pub const fn reverse ( & mut self ) {
992993 let half_len = self . len ( ) / 2 ;
993994 let Range { start, end } = self . as_mut_ptr_range ( ) ;
994995
@@ -1011,15 +1012,16 @@ impl<T> [T] {
10111012 revswap ( front_half, back_half, half_len) ;
10121013
10131014 #[ inline]
1014- fn revswap < T > ( a : & mut [ T ] , b : & mut [ T ] , n : usize ) {
1015+ const fn revswap < T > ( a : & mut [ T ] , b : & mut [ T ] , n : usize ) {
10151016 debug_assert ! ( a. len( ) == n) ;
10161017 debug_assert ! ( b. len( ) == n) ;
10171018
10181019 // Because this function is first compiled in isolation,
10191020 // this check tells LLVM that the indexing below is
10201021 // in-bounds. Then after inlining -- once the actual
10211022 // lengths of the slices are known -- it's removed.
1022- let ( a, b) = ( & mut a[ ..n] , & mut b[ ..n] ) ;
1023+ let ( a, _) = a. split_at_mut ( n) ;
1024+ let ( b, _) = b. split_at_mut ( n) ;
10231025
10241026 let mut i = 0 ;
10251027 while i < n {
0 commit comments