Rollup merge of #48450 - frewsxcv:frewsxcxv-stabilize-slice-rotatee, r=alexcrichton
Stabilize [T]::rotate_{left,right}
https://github.com/rust-lang/rust/issues/41891
This commit is contained in:
@@ -13,7 +13,6 @@
|
|||||||
#![feature(i128_type)]
|
#![feature(i128_type)]
|
||||||
#![feature(rand)]
|
#![feature(rand)]
|
||||||
#![feature(repr_simd)]
|
#![feature(repr_simd)]
|
||||||
#![feature(slice_rotate)]
|
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|||||||
@@ -79,7 +79,6 @@
|
|||||||
#![cfg_attr(test, feature(placement_in))]
|
#![cfg_attr(test, feature(placement_in))]
|
||||||
#![cfg_attr(not(test), feature(core_float))]
|
#![cfg_attr(not(test), feature(core_float))]
|
||||||
#![cfg_attr(not(test), feature(exact_size_is_empty))]
|
#![cfg_attr(not(test), feature(exact_size_is_empty))]
|
||||||
#![cfg_attr(not(test), feature(slice_rotate))]
|
|
||||||
#![cfg_attr(not(test), feature(generator_trait))]
|
#![cfg_attr(not(test), feature(generator_trait))]
|
||||||
#![cfg_attr(test, feature(rand, test))]
|
#![cfg_attr(test, feature(rand, test))]
|
||||||
#![feature(allow_internal_unstable)]
|
#![feature(allow_internal_unstable)]
|
||||||
|
|||||||
@@ -1460,8 +1460,6 @@ impl<T> [T] {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(slice_rotate)]
|
|
||||||
///
|
|
||||||
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
||||||
/// a.rotate_left(2);
|
/// a.rotate_left(2);
|
||||||
/// assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
|
/// assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']);
|
||||||
@@ -1470,23 +1468,15 @@ impl<T> [T] {
|
|||||||
/// Rotating a subslice:
|
/// Rotating a subslice:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(slice_rotate)]
|
|
||||||
///
|
|
||||||
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
||||||
/// a[1..5].rotate_left(1);
|
/// a[1..5].rotate_left(1);
|
||||||
/// assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']);
|
/// assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "slice_rotate", issue = "41891")]
|
#[stable(feature = "slice_rotate", since = "1.26.0")]
|
||||||
pub fn rotate_left(&mut self, mid: usize) {
|
pub fn rotate_left(&mut self, mid: usize) {
|
||||||
core_slice::SliceExt::rotate_left(self, mid);
|
core_slice::SliceExt::rotate_left(self, mid);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "slice_rotate", issue = "41891")]
|
|
||||||
#[rustc_deprecated(since = "", reason = "renamed to `rotate_left`")]
|
|
||||||
pub fn rotate(&mut self, mid: usize) {
|
|
||||||
core_slice::SliceExt::rotate_left(self, mid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Rotates the slice in-place such that the first `self.len() - k`
|
/// Rotates the slice in-place such that the first `self.len() - k`
|
||||||
/// elements of the slice move to the end while the last `k` elements move
|
/// elements of the slice move to the end while the last `k` elements move
|
||||||
/// to the front. After calling `rotate_right`, the element previously at
|
/// to the front. After calling `rotate_right`, the element previously at
|
||||||
@@ -1505,8 +1495,6 @@ impl<T> [T] {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(slice_rotate)]
|
|
||||||
///
|
|
||||||
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
||||||
/// a.rotate_right(2);
|
/// a.rotate_right(2);
|
||||||
/// assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);
|
/// assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']);
|
||||||
@@ -1515,13 +1503,11 @@ impl<T> [T] {
|
|||||||
/// Rotate a subslice:
|
/// Rotate a subslice:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(slice_rotate)]
|
|
||||||
///
|
|
||||||
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
/// let mut a = ['a', 'b', 'c', 'd', 'e', 'f'];
|
||||||
/// a[1..5].rotate_right(1);
|
/// a[1..5].rotate_right(1);
|
||||||
/// assert_eq!(a, ['a', 'e', 'b', 'c', 'd', 'f']);
|
/// assert_eq!(a, ['a', 'e', 'b', 'c', 'd', 'f']);
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "slice_rotate", issue = "41891")]
|
#[stable(feature = "slice_rotate", since = "1.26.0")]
|
||||||
pub fn rotate_right(&mut self, k: usize) {
|
pub fn rotate_right(&mut self, k: usize) {
|
||||||
core_slice::SliceExt::rotate_right(self, k);
|
core_slice::SliceExt::rotate_right(self, k);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#![feature(pattern)]
|
#![feature(pattern)]
|
||||||
#![feature(placement_in_syntax)]
|
#![feature(placement_in_syntax)]
|
||||||
#![feature(rand)]
|
#![feature(rand)]
|
||||||
#![feature(slice_rotate)]
|
|
||||||
#![feature(splice)]
|
#![feature(splice)]
|
||||||
#![feature(str_escape)]
|
#![feature(str_escape)]
|
||||||
#![feature(string_retain)]
|
#![feature(string_retain)]
|
||||||
|
|||||||
@@ -211,10 +211,10 @@ pub trait SliceExt {
|
|||||||
#[stable(feature = "core", since = "1.6.0")]
|
#[stable(feature = "core", since = "1.6.0")]
|
||||||
fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
|
fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
|
||||||
|
|
||||||
#[unstable(feature = "slice_rotate", issue = "41891")]
|
#[stable(feature = "slice_rotate", since = "1.26.0")]
|
||||||
fn rotate_left(&mut self, mid: usize);
|
fn rotate_left(&mut self, mid: usize);
|
||||||
|
|
||||||
#[unstable(feature = "slice_rotate", issue = "41891")]
|
#[stable(feature = "slice_rotate", since = "1.26.0")]
|
||||||
fn rotate_right(&mut self, k: usize);
|
fn rotate_right(&mut self, k: usize);
|
||||||
|
|
||||||
#[stable(feature = "clone_from_slice", since = "1.7.0")]
|
#[stable(feature = "clone_from_slice", since = "1.7.0")]
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
#![feature(refcell_replace_swap)]
|
#![feature(refcell_replace_swap)]
|
||||||
#![feature(sip_hash_13)]
|
#![feature(sip_hash_13)]
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
#![feature(slice_rotate)]
|
|
||||||
#![feature(sort_internals)]
|
#![feature(sort_internals)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(step_trait)]
|
#![feature(step_trait)]
|
||||||
|
|||||||
Reference in New Issue
Block a user