Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: Stabilize APIs for the 1.11.0 release #34530

Merged
merged 1 commit into from Jul 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/libcollections/binary_heap.rs
Expand Up @@ -825,8 +825,6 @@ impl<T: Ord> BinaryHeap<T> {
/// Basic usage:
///
/// ```
/// #![feature(binary_heap_append)]
///
/// use std::collections::BinaryHeap;
///
/// let v = vec![-10, 1, 2, 3, 3];
Expand All @@ -840,9 +838,7 @@ impl<T: Ord> BinaryHeap<T> {
/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
/// assert!(b.is_empty());
/// ```
#[unstable(feature = "binary_heap_append",
reason = "needs to be audited",
issue = "32526")]
#[stable(feature = "binary_heap_append", since = "1.11.0")]
pub fn append(&mut self, other: &mut Self) {
if self.len() < other.len() {
swap(self, other);
Expand Down
9 changes: 2 additions & 7 deletions src/libcollections/btree/map.rs
Expand Up @@ -559,7 +559,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// # Examples
///
/// ```
/// #![feature(btree_append)]
/// use std::collections::BTreeMap;
///
/// let mut a = BTreeMap::new();
Expand All @@ -583,8 +582,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(a[&4], "e");
/// assert_eq!(a[&5], "f");
/// ```
#[unstable(feature = "btree_append", reason = "recently added as part of collections reform 2",
issue = "34152")]
#[stable(feature = "btree_append", since = "1.11.0")]
pub fn append(&mut self, other: &mut Self) {
// Do we have to append anything at all?
if other.len() == 0 {
Expand Down Expand Up @@ -914,7 +912,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// Basic usage:
///
/// ```
/// #![feature(btree_split_off)]
/// use std::collections::BTreeMap;
///
/// let mut a = BTreeMap::new();
Expand All @@ -936,9 +933,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(b[&17], "d");
/// assert_eq!(b[&41], "e");
/// ```
#[unstable(feature = "btree_split_off",
reason = "recently added as part of collections reform 2",
issue = "34152")]
#[stable(feature = "btree_split_off", since = "1.11.0")]
pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
where K: Borrow<Q>
{
Expand Down
9 changes: 2 additions & 7 deletions src/libcollections/btree/set.rs
Expand Up @@ -551,7 +551,6 @@ impl<T: Ord> BTreeSet<T> {
/// # Examples
///
/// ```
/// #![feature(btree_append)]
/// use std::collections::BTreeSet;
///
/// let mut a = BTreeSet::new();
Expand All @@ -575,8 +574,7 @@ impl<T: Ord> BTreeSet<T> {
/// assert!(a.contains(&4));
/// assert!(a.contains(&5));
/// ```
#[unstable(feature = "btree_append", reason = "recently added as part of collections reform 2",
issue = "34152")]
#[stable(feature = "btree_append", since = "1.11.0")]
pub fn append(&mut self, other: &mut Self) {
self.map.append(&mut other.map);
}
Expand All @@ -589,7 +587,6 @@ impl<T: Ord> BTreeSet<T> {
/// Basic usage:
///
/// ```
/// #![feature(btree_split_off)]
/// use std::collections::BTreeMap;
///
/// let mut a = BTreeMap::new();
Expand All @@ -611,9 +608,7 @@ impl<T: Ord> BTreeSet<T> {
/// assert_eq!(b[&17], "d");
/// assert_eq!(b[&41], "e");
/// ```
#[unstable(feature = "btree_split_off",
reason = "recently added as part of collections reform 2",
issue = "34152")]
#[stable(feature = "btree_split_off", since = "1.11.0")]
pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self where T: Borrow<Q> {
BTreeSet { map: self.map.split_off(key) }
}
Expand Down
1 change: 0 additions & 1 deletion src/libcollections/lib.rs
Expand Up @@ -38,7 +38,6 @@
#![feature(fmt_internals)]
#![feature(heap_api)]
#![feature(inclusive_range)]
#![feature(iter_arith)]
#![feature(lang_items)]
#![feature(nonzero)]
#![feature(pattern)]
Expand Down
4 changes: 0 additions & 4 deletions src/libcollectionstest/lib.rs
Expand Up @@ -11,18 +11,14 @@
#![deny(warnings)]

#![feature(binary_heap_extras)]
#![feature(binary_heap_append)]
#![feature(binary_heap_peek_mut)]
#![feature(box_syntax)]
#![feature(btree_append)]
#![feature(btree_split_off)]
#![feature(btree_range)]
#![feature(collections)]
#![feature(collections_bound)]
#![feature(const_fn)]
#![feature(fn_traits)]
#![feature(enumset)]
#![feature(iter_arith)]
#![feature(linked_list_contains)]
#![feature(pattern)]
#![feature(rand)]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/cell.rs
Expand Up @@ -238,7 +238,7 @@ impl<T:Copy> Cell<T> {
/// This call borrows `Cell` mutably (at compile-time) which guarantees
/// that we possess the only reference.
#[inline]
#[unstable(feature = "cell_get_mut", issue = "33444")]
#[stable(feature = "cell_get_mut", since = "1.11.0")]
pub fn get_mut(&mut self) -> &mut T {
unsafe {
&mut *self.value.get()
Expand Down Expand Up @@ -509,7 +509,7 @@ impl<T: ?Sized> RefCell<T> {
/// This call borrows `RefCell` mutably (at compile-time) so there is no
/// need for dynamic checks.
#[inline]
#[unstable(feature = "cell_get_mut", issue="33444")]
#[stable(feature = "cell_get_mut", since = "1.11.0")]
pub fn get_mut(&mut self) -> &mut T {
unsafe {
&mut *self.value.get()
Expand Down
50 changes: 26 additions & 24 deletions src/libcore/iter/iterator.rs
Expand Up @@ -11,18 +11,16 @@
use clone::Clone;
use cmp::{Ord, PartialOrd, PartialEq, Ordering};
use default::Default;
use num::{Zero, One};
use ops::{Add, FnMut, Mul};
use ops::FnMut;
use option::Option::{self, Some, None};
use marker::Sized;

use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse,
Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev,
Zip};
use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse};
use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev};
use super::{Zip, Sum, Product};
use super::ChainState;
use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator,
IntoIterator};
use super::ZipImpl;
use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator};
use super::{IntoIterator, ZipImpl};

fn _assert_is_object_safe(_: &Iterator<Item=()>) {}

Expand Down Expand Up @@ -1820,50 +1818,54 @@ pub trait Iterator {
///
/// An empty iterator returns the zero value of the type.
///
/// # Panics
///
/// When calling `sum` and a primitive integer type is being returned, this
/// method will panic if the computation overflows.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(iter_arith)]
///
/// let a = [1, 2, 3];
/// let sum: i32 = a.iter().sum();
///
/// assert_eq!(sum, 6);
/// ```
#[unstable(feature = "iter_arith", reason = "bounds recently changed",
issue = "27739")]
fn sum<S>(self) -> S where
S: Add<Self::Item, Output=S> + Zero,
Self: Sized,
#[stable(feature = "iter_arith", since = "1.11.0")]
fn sum<S>(self) -> S
where Self: Sized,
S: Sum<Self::Item>,
{
self.fold(Zero::zero(), |s, e| s + e)
Sum::sum(self)
}

/// Iterates over the entire iterator, multiplying all the elements
///
/// An empty iterator returns the one value of the type.
///
/// # Panics
///
/// When calling `product` and a primitive integer type is being returned,
/// this method will panic if the computation overflows.
///
/// # Examples
///
/// ```
/// #![feature(iter_arith)]
///
/// fn factorial(n: u32) -> u32 {
/// (1..).take_while(|&i| i <= n).product()
/// }
/// assert_eq!(factorial(0), 1);
/// assert_eq!(factorial(1), 1);
/// assert_eq!(factorial(5), 120);
/// ```
#[unstable(feature="iter_arith", reason = "bounds recently changed",
issue = "27739")]
fn product<P>(self) -> P where
P: Mul<Self::Item, Output=P> + One,
Self: Sized,
#[stable(feature = "iter_arith", since = "1.11.0")]
fn product<P>(self) -> P
where Self: Sized,
P: Product<Self::Item>,
{
self.fold(One::one(), |p, e| p * e)
Product::product(self)
}

/// Lexicographically compares the elements of this `Iterator` with those
Expand Down
5 changes: 3 additions & 2 deletions src/libcore/iter/mod.rs
Expand Up @@ -327,8 +327,9 @@ pub use self::sources::{Empty, empty};
pub use self::sources::{Once, once};

#[stable(feature = "rust1", since = "1.0.0")]
pub use self::traits::{FromIterator, IntoIterator, DoubleEndedIterator, Extend,
ExactSizeIterator};
pub use self::traits::{FromIterator, IntoIterator, DoubleEndedIterator, Extend};
#[stable(feature = "rust1", since = "1.0.0")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this stability attribute meaningful? If so, it's wrong!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah these end up not really meaning anything, especially on reexports. Right now we just validate that they're there and... that's pretty much it. This is probably one of the least egregious violations we have :)

pub use self::traits::{ExactSizeIterator, Sum, Product};

mod iterator;
mod range;
Expand Down