Skip to content

Commit

Permalink
collections: Add issues for unstable features
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Aug 16, 2015
1 parent 3263d41 commit 377c11a
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 65 deletions.
5 changes: 3 additions & 2 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ impl<T: Ord> BinaryHeap<T> {
#[inline]
#[unstable(feature = "drain",
reason = "matches collection reform specification, \
waiting for dust to settle")]
waiting for dust to settle",
issue = "27711")]
pub fn drain(&mut self) -> Drain<T> {
Drain { iter: self.data.drain(..) }
}
Expand Down Expand Up @@ -685,7 +686,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
impl<T> ExactSizeIterator for IntoIter<T> {}

/// An iterator that drains a `BinaryHeap`.
#[unstable(feature = "drain", reason = "recent addition")]
#[unstable(feature = "drain", reason = "recent addition", issue = "27711")]
pub struct Drain<'a, T: 'a> {
iter: vec::Drain<'a, T>,
}
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned
}

/// Trait for moving into a `Cow`.
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`")]
#[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
issue = "27735")]
pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
/// Moves `self` into `Cow`
fn into_cow(self) -> Cow<'a, B>;
Expand Down
9 changes: 7 additions & 2 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// Makes a new empty BTreeMap with the given B.
///
/// B cannot be less than 2.
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually",
issue = "27795")]
pub fn with_b(b: usize) -> BTreeMap<K, V> {
assert!(b > 1, "B must be greater than 1");
BTreeMap {
Expand Down Expand Up @@ -1504,7 +1507,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(Some((&5, &"b")), map.range(Included(&4), Unbounded).next());
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle")]
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
pub fn range<Min: ?Sized + Ord = K, Max: ?Sized + Ord = K>(&self, min: Bound<&Min>,
max: Bound<&Max>)
-> Range<K, V> where
Expand Down Expand Up @@ -1537,7 +1541,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// }
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle")]
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
pub fn range_mut<Min: ?Sized + Ord = K, Max: ?Sized + Ord = K>(&mut self, min: Bound<&Min>,
max: Bound<&Max>)
-> RangeMut<K, V> where
Expand Down
6 changes: 4 additions & 2 deletions src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ impl<T: Ord> BTreeSet<T> {
///
/// B cannot be less than 2.
#[unstable(feature = "btree_b",
reason = "probably want this to be on the type, eventually")]
reason = "probably want this to be on the type, eventually",
issue = "27795")]
pub fn with_b(b: usize) -> BTreeSet<T> {
BTreeSet { map: BTreeMap::with_b(b) }
}
Expand Down Expand Up @@ -154,7 +155,8 @@ impl<T: Ord> BTreeSet<T> {
/// assert_eq!(Some(&5), set.range(Included(&4), Unbounded).next());
/// ```
#[unstable(feature = "btree_range",
reason = "matches collection reform specification, waiting for dust to settle")]
reason = "matches collection reform specification, waiting for dust to settle",
issue = "27787")]
pub fn range<'a, Min: ?Sized + Ord = T, Max: ?Sized + Ord = T>(&'a self, min: Bound<&Min>,
max: Bound<&Max>)
-> Range<'a, T> where
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#![unstable(feature = "enumset",
reason = "matches collection reform specification, \
waiting for dust to settle")]
waiting for dust to settle",
issue = "0")]

use core::marker;
use core::fmt;
Expand Down
5 changes: 3 additions & 2 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#![crate_type = "rlib"]
#![unstable(feature = "collections",
reason = "library is unlikely to be stabilized with the current \
layout and name, use std::collections instead")]
layout and name, use std::collections instead",
issue = "27783")]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/",
Expand Down Expand Up @@ -110,7 +111,7 @@ mod std {
}

/// An endpoint of a range of keys.
#[unstable(feature = "collections_bound")]
#[unstable(feature = "collections_bound", issue = "27711")]
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
pub enum Bound<T> {
/// An inclusive bound.
Expand Down
6 changes: 4 additions & 2 deletions src/libcollections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ impl<'a, A> IterMut<'a, A> {
/// ```
#[inline]
#[unstable(feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see")]
reason = "this is probably better handled by a cursor type -- we'll see",
issue = "27794")]
pub fn insert_next(&mut self, elt: A) {
self.insert_next_node(box Node::new(elt))
}
Expand All @@ -825,7 +826,8 @@ impl<'a, A> IterMut<'a, A> {
/// ```
#[inline]
#[unstable(feature = "linked_list_extras",
reason = "this is probably better handled by a cursor type -- we'll see")]
reason = "this is probably better handled by a cursor type -- we'll see",
issue = "27794")]
pub fn peek_next(&mut self) -> Option<&mut A> {
if self.nelem == 0 {
return None
Expand Down
3 changes: 2 additions & 1 deletion src/libcollections/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![unstable(feature = "collections_range", reason = "was just added")]
#![unstable(feature = "collections_range", reason = "was just added",
issue = "27711")]

//! Range syntax.
Expand Down
16 changes: 9 additions & 7 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,29 +214,29 @@ impl<T> [T] {
}

/// Returns the first and all the rest of the elements of a slice.
#[unstable(feature = "slice_splits", reason = "new API")]
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
#[inline]
pub fn split_first(&self) -> Option<(&T, &[T])> {
core_slice::SliceExt::split_first(self)
}

/// Returns the first and all the rest of the elements of a slice.
#[unstable(feature = "slice_splits", reason = "new API")]
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
#[inline]
pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> {
core_slice::SliceExt::split_first_mut(self)
}

/// Returns the last and all the rest of the elements of a slice.
#[unstable(feature = "slice_splits", reason = "new API")]
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
#[inline]
pub fn split_last(&self) -> Option<(&T, &[T])> {
core_slice::SliceExt::split_last(self)

}

/// Returns the last and all the rest of the elements of a slice.
#[unstable(feature = "slice_splits", since = "1.3.0")]
#[unstable(feature = "slice_splits", reason = "new API", issue = "27742")]
#[inline]
pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> {
core_slice::SliceExt::split_last_mut(self)
Expand Down Expand Up @@ -785,7 +785,7 @@ impl<T> [T] {
/// assert!(dst.clone_from_slice(&src2) == 3);
/// assert!(dst == [3, 4, 5]);
/// ```
#[unstable(feature = "clone_from_slice")]
#[unstable(feature = "clone_from_slice", issue = "27750")]
pub fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone {
core_slice::SliceExt::clone_from_slice(self, src)
}
Expand All @@ -811,11 +811,13 @@ impl<T> [T] {
// Extension traits for slices over specific kinds of data
////////////////////////////////////////////////////////////////////////////////
#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist")]
reason = "trait should not have to exist",
issue = "27747")]
/// An extension trait for concatenating slices
pub trait SliceConcatExt<T: ?Sized> {
#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist")]
reason = "trait should not have to exist",
issue = "27747")]
/// The resulting type after concatenation
type Output;

Expand Down
47 changes: 31 additions & 16 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
///
/// For use with the `std::iter` module.
#[derive(Clone)]
#[unstable(feature = "str_utf16")]
#[unstable(feature = "str_utf16", issue = "27714")]
pub struct Utf16Units<'a> {
encoder: Utf16Encoder<Chars<'a>>
}
Expand Down Expand Up @@ -211,7 +211,8 @@ impl str {
reason = "it is unclear whether this method pulls its weight \
with the existence of the char_indices iterator or \
this method may want to be replaced with checked \
slicing")]
slicing",
issue = "27754")]
#[inline]
pub fn is_char_boundary(&self, index: usize) -> bool {
core_str::StrExt::is_char_boundary(self, index)
Expand Down Expand Up @@ -275,7 +276,8 @@ impl str {
/// Takes a bytewise mutable slice from a string.
///
/// Same as `slice_unchecked`, but works with `&mut str` instead of `&str`.
#[unstable(feature = "str_slice_mut", reason = "recently added")]
#[unstable(feature = "str_slice_mut", reason = "recently added",
issue = "27793")]
#[inline]
pub unsafe fn slice_mut_unchecked(&mut self, begin: usize, end: usize) -> &mut str {
core_str::StrExt::slice_mut_unchecked(self, begin, end)
Expand Down Expand Up @@ -329,7 +331,8 @@ impl str {
#[unstable(feature = "str_char",
reason = "often replaced by char_indices, this method may \
be removed in favor of just char_at() or eventually \
removed altogether")]
removed altogether",
issue = "27754")]
#[inline]
pub fn char_range_at(&self, start: usize) -> CharRange {
core_str::StrExt::char_range_at(self, start)
Expand Down Expand Up @@ -388,7 +391,8 @@ impl str {
#[unstable(feature = "str_char",
reason = "often replaced by char_indices, this method may \
be removed in favor of just char_at_reverse() or \
eventually removed altogether")]
eventually removed altogether",
issue = "27754")]
#[inline]
pub fn char_range_at_reverse(&self, start: usize) -> CharRange {
core_str::StrExt::char_range_at_reverse(self, start)
Expand Down Expand Up @@ -416,7 +420,8 @@ impl str {
method may be removed or possibly renamed in the \
future; it is normally replaced by chars/char_indices \
iterators or by getting the first char from a \
subslice")]
subslice",
issue = "27754")]
#[inline]
pub fn char_at(&self, i: usize) -> char {
core_str::StrExt::char_at(self, i)
Expand All @@ -443,7 +448,8 @@ impl str {
#[unstable(feature = "str_char",
reason = "see char_at for more details, but reverse semantics \
are also somewhat unclear, especially with which \
cases generate panics")]
cases generate panics",
issue = "27754")]
#[inline]
pub fn char_at_reverse(&self, i: usize) -> char {
core_str::StrExt::char_at_reverse(self, i)
Expand Down Expand Up @@ -478,7 +484,8 @@ impl str {
#[unstable(feature = "str_char",
reason = "awaiting conventions about shifting and slices and \
may not be warranted with the existence of the chars \
and/or char_indices iterators")]
and/or char_indices iterators",
issue = "27754")]
#[inline]
pub fn slice_shift_char(&self) -> Option<(char, &str)> {
core_str::StrExt::slice_shift_char(self)
Expand Down Expand Up @@ -508,14 +515,16 @@ impl str {
/// assert_eq!(b, " 老虎 Léopard");
/// ```
#[inline]
#[unstable(feature = "str_split_at", reason = "recently added")]
#[unstable(feature = "str_split_at", reason = "recently added",
issue = "27792")]
pub fn split_at(&self, mid: usize) -> (&str, &str) {
core_str::StrExt::split_at(self, mid)
}

/// Divide one mutable string slice into two at an index.
#[inline]
#[unstable(feature = "str_split_at", reason = "recently added")]
#[unstable(feature = "str_split_at", reason = "recently added",
issue = "27792")]
pub fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) {
core_str::StrExt::split_at_mut(self, mid)
}
Expand Down Expand Up @@ -652,7 +661,8 @@ impl str {

/// Returns an iterator of `u16` over the string encoded as UTF-16.
#[unstable(feature = "str_utf16",
reason = "this functionality may only be provided by libunicode")]
reason = "this functionality may only be provided by libunicode",
issue = "27714")]
pub fn utf16_units(&self) -> Utf16Units {
Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) }
}
Expand Down Expand Up @@ -1186,7 +1196,8 @@ impl str {
/// assert_eq!(v, [(0, 3)]); // only the first `aba`
/// ```
#[unstable(feature = "str_match_indices",
reason = "might have its iterator type changed")]
reason = "might have its iterator type changed",
issue = "27743")]
// NB: Right now MatchIndices yields `(usize, usize)`, but it would
// be more consistent with `matches` and `char_indices` to return `(usize, &str)`
pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P> {
Expand Down Expand Up @@ -1231,7 +1242,8 @@ impl str {
/// assert_eq!(v, [(2, 5)]); // only the last `aba`
/// ```
#[unstable(feature = "str_match_indices",
reason = "might have its iterator type changed")]
reason = "might have its iterator type changed",
issue = "27743")]
// NB: Right now RMatchIndices yields `(usize, usize)`, but it would
// be more consistent with `rmatches` and `char_indices` to return `(usize, &str)`
pub fn rmatch_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatchIndices<'a, P>
Expand Down Expand Up @@ -1476,21 +1488,24 @@ impl str {

/// Escapes each char in `s` with `char::escape_default`.
#[unstable(feature = "str_escape",
reason = "return type may change to be an iterator")]
reason = "return type may change to be an iterator",
issue = "27791")]
pub fn escape_default(&self) -> String {
self.chars().flat_map(|c| c.escape_default()).collect()
}

/// Escapes each char in `s` with `char::escape_unicode`.
#[unstable(feature = "str_escape",
reason = "return type may change to be an iterator")]
reason = "return type may change to be an iterator",
issue = "27791")]
pub fn escape_unicode(&self) -> String {
self.chars().flat_map(|c| c.escape_unicode()).collect()
}

/// Converts the `Box<str>` into a `String` without copying or allocating.
#[unstable(feature = "box_str",
reason = "recently added, matches RFC")]
reason = "recently added, matches RFC",
issue = "27785")]
pub fn into_string(self: Box<str>) -> String {
unsafe {
let slice = mem::transmute::<Box<str>, Box<[u8]>>(self);
Expand Down
Loading

0 comments on commit 377c11a

Please sign in to comment.