Skip to content

Commit 3016626

Browse files
committed
std: Stabilize APIs for the 1.11.0 release
Although the set of APIs being stabilized this release is relatively small, the trains keep going! Listed below are the APIs in the standard library which have either transitioned from unstable to stable or those from unstable to deprecated. Stable * `BTreeMap::{append, split_off}` * `BTreeSet::{append, split_off}` * `Cell::get_mut` * `RefCell::get_mut` * `BinaryHeap::append` * `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past libstd stabilizations * `Iterator::sum` * `Iterator::product` Deprecated * `{f32, f64}::next_after` * `{f32, f64}::integer_decode` * `{f32, f64}::ldexp` * `{f32, f64}::frexp` * `num::One` * `num::Zero` Added APIs (all unstable) * `iter::Sum` * `iter::Product` * `iter::Step` - a few methods were added to accomodate deprecation of One/Zero Removed APIs * `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is unstable Closes #27739 Closes #27752 Closes #32526 Closes #33444 Closes #34152 cc #34529 (new tracking issue)
1 parent 375fa6e commit 3016626

File tree

36 files changed

+507
-194
lines changed

36 files changed

+507
-194
lines changed

src/libcollections/binary_heap.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,6 @@ impl<T: Ord> BinaryHeap<T> {
825825
/// Basic usage:
826826
///
827827
/// ```
828-
/// #![feature(binary_heap_append)]
829-
///
830828
/// use std::collections::BinaryHeap;
831829
///
832830
/// let v = vec![-10, 1, 2, 3, 3];
@@ -840,9 +838,7 @@ impl<T: Ord> BinaryHeap<T> {
840838
/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
841839
/// assert!(b.is_empty());
842840
/// ```
843-
#[unstable(feature = "binary_heap_append",
844-
reason = "needs to be audited",
845-
issue = "32526")]
841+
#[stable(feature = "binary_heap_append", since = "1.11.0")]
846842
pub fn append(&mut self, other: &mut Self) {
847843
if self.len() < other.len() {
848844
swap(self, other);

src/libcollections/btree/map.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
559559
/// # Examples
560560
///
561561
/// ```
562-
/// #![feature(btree_append)]
563562
/// use std::collections::BTreeMap;
564563
///
565564
/// let mut a = BTreeMap::new();
@@ -583,8 +582,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
583582
/// assert_eq!(a[&4], "e");
584583
/// assert_eq!(a[&5], "f");
585584
/// ```
586-
#[unstable(feature = "btree_append", reason = "recently added as part of collections reform 2",
587-
issue = "34152")]
585+
#[stable(feature = "btree_append", since = "1.11.0")]
588586
pub fn append(&mut self, other: &mut Self) {
589587
// Do we have to append anything at all?
590588
if other.len() == 0 {
@@ -914,7 +912,6 @@ impl<K: Ord, V> BTreeMap<K, V> {
914912
/// Basic usage:
915913
///
916914
/// ```
917-
/// #![feature(btree_split_off)]
918915
/// use std::collections::BTreeMap;
919916
///
920917
/// let mut a = BTreeMap::new();
@@ -936,9 +933,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
936933
/// assert_eq!(b[&17], "d");
937934
/// assert_eq!(b[&41], "e");
938935
/// ```
939-
#[unstable(feature = "btree_split_off",
940-
reason = "recently added as part of collections reform 2",
941-
issue = "34152")]
936+
#[stable(feature = "btree_split_off", since = "1.11.0")]
942937
pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
943938
where K: Borrow<Q>
944939
{

src/libcollections/btree/set.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ impl<T: Ord> BTreeSet<T> {
551551
/// # Examples
552552
///
553553
/// ```
554-
/// #![feature(btree_append)]
555554
/// use std::collections::BTreeSet;
556555
///
557556
/// let mut a = BTreeSet::new();
@@ -575,8 +574,7 @@ impl<T: Ord> BTreeSet<T> {
575574
/// assert!(a.contains(&4));
576575
/// assert!(a.contains(&5));
577576
/// ```
578-
#[unstable(feature = "btree_append", reason = "recently added as part of collections reform 2",
579-
issue = "34152")]
577+
#[stable(feature = "btree_append", since = "1.11.0")]
580578
pub fn append(&mut self, other: &mut Self) {
581579
self.map.append(&mut other.map);
582580
}
@@ -589,7 +587,6 @@ impl<T: Ord> BTreeSet<T> {
589587
/// Basic usage:
590588
///
591589
/// ```
592-
/// #![feature(btree_split_off)]
593590
/// use std::collections::BTreeMap;
594591
///
595592
/// let mut a = BTreeMap::new();
@@ -611,9 +608,7 @@ impl<T: Ord> BTreeSet<T> {
611608
/// assert_eq!(b[&17], "d");
612609
/// assert_eq!(b[&41], "e");
613610
/// ```
614-
#[unstable(feature = "btree_split_off",
615-
reason = "recently added as part of collections reform 2",
616-
issue = "34152")]
611+
#[stable(feature = "btree_split_off", since = "1.11.0")]
617612
pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self where T: Borrow<Q> {
618613
BTreeSet { map: self.map.split_off(key) }
619614
}

src/libcollections/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#![feature(fmt_internals)]
3939
#![feature(heap_api)]
4040
#![feature(inclusive_range)]
41-
#![feature(iter_arith)]
4241
#![feature(lang_items)]
4342
#![feature(nonzero)]
4443
#![feature(pattern)]

src/libcollectionstest/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,14 @@
1111
#![deny(warnings)]
1212

1313
#![feature(binary_heap_extras)]
14-
#![feature(binary_heap_append)]
1514
#![feature(binary_heap_peek_mut)]
1615
#![feature(box_syntax)]
17-
#![feature(btree_append)]
18-
#![feature(btree_split_off)]
1916
#![feature(btree_range)]
2017
#![feature(collections)]
2118
#![feature(collections_bound)]
2219
#![feature(const_fn)]
2320
#![feature(fn_traits)]
2421
#![feature(enumset)]
25-
#![feature(iter_arith)]
2622
#![feature(linked_list_contains)]
2723
#![feature(pattern)]
2824
#![feature(rand)]

src/libcore/cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<T:Copy> Cell<T> {
238238
/// This call borrows `Cell` mutably (at compile-time) which guarantees
239239
/// that we possess the only reference.
240240
#[inline]
241-
#[unstable(feature = "cell_get_mut", issue = "33444")]
241+
#[stable(feature = "cell_get_mut", since = "1.11.0")]
242242
pub fn get_mut(&mut self) -> &mut T {
243243
unsafe {
244244
&mut *self.value.get()
@@ -509,7 +509,7 @@ impl<T: ?Sized> RefCell<T> {
509509
/// This call borrows `RefCell` mutably (at compile-time) so there is no
510510
/// need for dynamic checks.
511511
#[inline]
512-
#[unstable(feature = "cell_get_mut", issue="33444")]
512+
#[stable(feature = "cell_get_mut", since = "1.11.0")]
513513
pub fn get_mut(&mut self) -> &mut T {
514514
unsafe {
515515
&mut *self.value.get()

src/libcore/iter/iterator.rs

+26-24
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@
1111
use clone::Clone;
1212
use cmp::{Ord, PartialOrd, PartialEq, Ordering};
1313
use default::Default;
14-
use num::{Zero, One};
15-
use ops::{Add, FnMut, Mul};
14+
use ops::FnMut;
1615
use option::Option::{self, Some, None};
1716
use marker::Sized;
1817

19-
use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse,
20-
Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev,
21-
Zip};
18+
use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse};
19+
use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev};
20+
use super::{Zip, Sum, Product};
2221
use super::ChainState;
23-
use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator,
24-
IntoIterator};
25-
use super::ZipImpl;
22+
use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator};
23+
use super::{IntoIterator, ZipImpl};
2624

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

@@ -1820,50 +1818,54 @@ pub trait Iterator {
18201818
///
18211819
/// An empty iterator returns the zero value of the type.
18221820
///
1821+
/// # Panics
1822+
///
1823+
/// When calling `sum` and a primitive integer type is being returned, this
1824+
/// method will panic if the computation overflows.
1825+
///
18231826
/// # Examples
18241827
///
18251828
/// Basic usage:
18261829
///
18271830
/// ```
1828-
/// #![feature(iter_arith)]
1829-
///
18301831
/// let a = [1, 2, 3];
18311832
/// let sum: i32 = a.iter().sum();
18321833
///
18331834
/// assert_eq!(sum, 6);
18341835
/// ```
1835-
#[unstable(feature = "iter_arith", reason = "bounds recently changed",
1836-
issue = "27739")]
1837-
fn sum<S>(self) -> S where
1838-
S: Add<Self::Item, Output=S> + Zero,
1839-
Self: Sized,
1836+
#[stable(feature = "iter_arith", since = "1.11.0")]
1837+
fn sum<S>(self) -> S
1838+
where Self: Sized,
1839+
S: Sum<Self::Item>,
18401840
{
1841-
self.fold(Zero::zero(), |s, e| s + e)
1841+
Sum::sum(self)
18421842
}
18431843

18441844
/// Iterates over the entire iterator, multiplying all the elements
18451845
///
18461846
/// An empty iterator returns the one value of the type.
18471847
///
1848+
/// # Panics
1849+
///
1850+
/// When calling `product` and a primitive integer type is being returned,
1851+
/// this method will panic if the computation overflows.
1852+
///
18481853
/// # Examples
18491854
///
18501855
/// ```
1851-
/// #![feature(iter_arith)]
1852-
///
18531856
/// fn factorial(n: u32) -> u32 {
18541857
/// (1..).take_while(|&i| i <= n).product()
18551858
/// }
18561859
/// assert_eq!(factorial(0), 1);
18571860
/// assert_eq!(factorial(1), 1);
18581861
/// assert_eq!(factorial(5), 120);
18591862
/// ```
1860-
#[unstable(feature="iter_arith", reason = "bounds recently changed",
1861-
issue = "27739")]
1862-
fn product<P>(self) -> P where
1863-
P: Mul<Self::Item, Output=P> + One,
1864-
Self: Sized,
1863+
#[stable(feature = "iter_arith", since = "1.11.0")]
1864+
fn product<P>(self) -> P
1865+
where Self: Sized,
1866+
P: Product<Self::Item>,
18651867
{
1866-
self.fold(One::one(), |p, e| p * e)
1868+
Product::product(self)
18671869
}
18681870

18691871
/// Lexicographically compares the elements of this `Iterator` with those

src/libcore/iter/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,9 @@ pub use self::sources::{Empty, empty};
327327
pub use self::sources::{Once, once};
328328

329329
#[stable(feature = "rust1", since = "1.0.0")]
330-
pub use self::traits::{FromIterator, IntoIterator, DoubleEndedIterator, Extend,
331-
ExactSizeIterator};
330+
pub use self::traits::{FromIterator, IntoIterator, DoubleEndedIterator, Extend};
331+
#[stable(feature = "rust1", since = "1.0.0")]
332+
pub use self::traits::{ExactSizeIterator, Sum, Product};
332333

333334
mod iterator;
334335
mod range;

0 commit comments

Comments
 (0)