@@ -788,15 +788,12 @@ impl<T> [T] {
788
788
/// # Examples
789
789
///
790
790
/// ```rust
791
- /// #![feature(slice_sort_by_key)]
792
- ///
793
791
/// let mut v = [-5i32, 4, 1, -3, 2];
794
792
///
795
793
/// v.sort_by_key(|k| k.abs());
796
794
/// assert!(v == [1, 2, -3, 4, -5]);
797
795
/// ```
798
- #[ unstable( feature = "slice_sort_by_key" , reason = "recently added" ,
799
- issue = "27724" ) ]
796
+ #[ stable( feature = "slice_sort_by_key" , since = "1.7.0" ) ]
800
797
#[ inline]
801
798
pub fn sort_by_key < B , F > ( & mut self , mut f : F )
802
799
where F : FnMut ( & T ) -> B , B : Ord
@@ -829,29 +826,25 @@ impl<T> [T] {
829
826
merge_sort ( self , compare)
830
827
}
831
828
832
- /// Copies as many elements from `src` as it can into `self` (the
833
- /// shorter of `self.len()` and `src.len()`). Returns the number
834
- /// of elements copied.
829
+ /// Copies the elements from `src` into `self`.
830
+ ///
831
+ /// The length of this slice must be the same as the slice passed in.
832
+ ///
833
+ /// # Panics
834
+ ///
835
+ /// This function will panic if the two slices have different lengths.
835
836
///
836
837
/// # Example
837
838
///
838
839
/// ```rust
839
- /// #![feature(clone_from_slice)]
840
- ///
841
840
/// let mut dst = [0, 0, 0];
842
- /// let src = [1, 2];
843
- ///
844
- /// assert!(dst.clone_from_slice(&src) == 2);
845
- /// assert!(dst == [1, 2, 0]);
841
+ /// let src = [1, 2, 3];
846
842
///
847
- /// let src2 = [3, 4, 5, 6];
848
- /// assert!(dst.clone_from_slice(&src2) == 3);
849
- /// assert!(dst == [3, 4, 5]);
843
+ /// dst.clone_from_slice(&src);
844
+ /// assert!(dst == [1, 2, 3]);
850
845
/// ```
851
- #[ unstable( feature = "clone_from_slice" , issue = "27750" ) ]
852
- pub fn clone_from_slice ( & mut self , src : & [ T ] ) -> usize
853
- where T : Clone
854
- {
846
+ #[ stable( feature = "clone_from_slice" , since = "1.7.0" ) ]
847
+ pub fn clone_from_slice ( & mut self , src : & [ T ] ) where T : Clone {
855
848
core_slice:: SliceExt :: clone_from_slice ( self , src)
856
849
}
857
850
0 commit comments