]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/slice.rs
core: Split apart the global `core` feature
[rust.git] / src / libcore / slice.rs
index 2dc28a4786f2dd76169672ee069d783378370db8..c979b97731b4f1aec4fb8804a937d8e6e918ab09 100644 (file)
@@ -64,6 +64,8 @@
 /// Extension methods for slices.
 #[allow(missing_docs)] // docs in libcollections
 #[doc(hidden)]
+#[unstable(feature = "core_slice_ext",
+           reason = "stable interface provided by `impl [T]` in later crates")]
 pub trait SliceExt {
     type Item;
 
@@ -148,7 +150,6 @@ macro_rules! slice_ref {
     }};
 }
 
-#[unstable(feature = "core")]
 impl<T> SliceExt for [T] {
     type Item = T;
 
@@ -256,7 +257,6 @@ fn as_ptr(&self) -> *const T {
         self.repr().data
     }
 
-    #[unstable(feature = "core")]
     fn binary_search_by<F>(&self, mut f: F) -> Result<usize, usize> where
         F: FnMut(&T) -> Ordering
     {
@@ -437,12 +437,10 @@ fn ends_with(&self, needle: &[T]) -> bool where T: PartialEq {
         m >= n && needle == &self[m-n..]
     }
 
-    #[unstable(feature = "core")]
     fn binary_search(&self, x: &T) -> Result<usize, usize> where T: Ord {
         self.binary_search_by(|p| p.cmp(x))
     }
 
-    #[unstable(feature = "core")]
     fn next_permutation(&mut self) -> bool where T: Ord {
         // These cases only have 1 permutation each, so we can't do anything.
         if self.len() < 2 { return false; }
@@ -473,7 +471,6 @@ fn next_permutation(&mut self) -> bool where T: Ord {
         true
     }
 
-    #[unstable(feature = "core")]
     fn prev_permutation(&mut self) -> bool where T: Ord {
         // These cases only have 1 permutation each, so we can't do anything.
         if self.len() < 2 { return false; }
@@ -774,7 +771,7 @@ impl<'a, T> Iter<'a, T> {
     ///
     /// This has the same lifetime as the original slice, and so the
     /// iterator can continue to be used while this exists.
-    #[unstable(feature = "core")]
+    #[unstable(feature = "iter_to_slice")]
     pub fn as_slice(&self) -> &'a [T] {
         make_slice!(self.ptr, self.end)
     }
@@ -804,7 +801,7 @@ impl<'a, T> Clone for Iter<'a, T> {
     fn clone(&self) -> Iter<'a, T> { Iter { ptr: self.ptr, end: self.end, _marker: self._marker } }
 }
 
-#[unstable(feature = "core", reason = "trait is experimental")]
+#[unstable(feature = "iter_idx", reason = "trait is experimental")]
 impl<'a, T> RandomAccessIterator for Iter<'a, T> {
     #[inline]
     fn indexable(&self) -> usize {
@@ -842,7 +839,7 @@ impl<'a, T> IterMut<'a, T> {
     /// to consume the iterator. Consider using the `Slice` and
     /// `SliceMut` implementations for obtaining slices with more
     /// restricted lifetimes that do not consume the iterator.
-    #[unstable(feature = "core")]
+    #[unstable(feature = "iter_to_slice")]
     pub fn into_slice(self) -> &'a mut [T] {
         make_mut_slice!(self.ptr, self.end)
     }
@@ -1176,7 +1173,7 @@ fn next_back(&mut self) -> Option<&'a [T]> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> ExactSizeIterator for Windows<'a, T> {}
 
-#[unstable(feature = "core", reason = "trait is experimental")]
+#[unstable(feature = "iter_idx", reason = "trait is experimental")]
 impl<'a, T> RandomAccessIterator for Windows<'a, T> {
     #[inline]
     fn indexable(&self) -> usize {
@@ -1263,7 +1260,7 @@ fn next_back(&mut self) -> Option<&'a [T]> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T> ExactSizeIterator for Chunks<'a, T> {}
 
-#[unstable(feature = "core", reason = "trait is experimental")]
+#[unstable(feature = "iter_idx", reason = "trait is experimental")]
 impl<'a, T> RandomAccessIterator for Chunks<'a, T> {
     #[inline]
     fn indexable(&self) -> usize {
@@ -1349,7 +1346,7 @@ impl<'a, T> ExactSizeIterator for ChunksMut<'a, T> {}
 //
 
 /// Converts a pointer to A into a slice of length 1 (without copying).
-#[unstable(feature = "core")]
+#[unstable(feature = "ref_slice")]
 pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
     unsafe {
         from_raw_parts(s, 1)
@@ -1357,7 +1354,7 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
 }
 
 /// Converts a pointer to A into a slice of length 1 (without copying).
-#[unstable(feature = "core")]
+#[unstable(feature = "ref_slice")]
 pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
     unsafe {
         from_raw_parts_mut(s, 1)
@@ -1415,7 +1412,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] {
 //
 
 /// Operations on `[u8]`.
-#[unstable(feature = "core", reason = "needs review")]
+#[unstable(feature = "slice_bytes", reason = "needs review")]
 pub mod bytes {
     use ptr;
     use slice::SliceExt;
@@ -1503,7 +1500,7 @@ fn gt(&self, other: &[T]) -> bool {
 }
 
 /// Extension methods for slices containing integers.
-#[unstable(feature = "core")]
+#[unstable(feature = "int_slice")]
 pub trait IntSliceExt<U, S> {
     /// Converts the slice to an immutable slice of unsigned integers with the same width.
     fn as_unsigned<'a>(&'a self) -> &'a [U];
@@ -1518,7 +1515,7 @@ pub trait IntSliceExt<U, S> {
 
 macro_rules! impl_int_slice {
     ($u:ty, $s:ty, $t:ty) => {
-        #[unstable(feature = "core")]
+        #[unstable(feature = "int_slice")]
         impl IntSliceExt<$u, $s> for [$t] {
             #[inline]
             fn as_unsigned(&self) -> &[$u] { unsafe { transmute(self) } }