Skip to content

Commit 2e883a5

Browse files
committed
rollup merge of rust-lang#20560: aturon/stab-2-iter-ops-slice
Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2 parents bb5e16b + c6f4a03 commit 2e883a5

32 files changed

+574
-362
lines changed

src/liballoc/arc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<T> BorrowFrom<Arc<T>> for T {
246246
}
247247
}
248248

249-
#[experimental = "Deref is experimental."]
249+
#[stable]
250250
impl<T> Deref for Arc<T> {
251251
type Target = T;
252252

@@ -290,7 +290,7 @@ impl<T: Send + Sync + Clone> Arc<T> {
290290
}
291291

292292
#[unsafe_destructor]
293-
#[experimental = "waiting on stability of Drop"]
293+
#[stable]
294294
impl<T: Sync + Send> Drop for Arc<T> {
295295
/// Drops the `Arc<T>`.
296296
///
@@ -418,7 +418,7 @@ impl<T: Sync + Send> Clone for Weak<T> {
418418
}
419419

420420
#[unsafe_destructor]
421-
#[experimental = "Weak pointers may not belong in this module."]
421+
#[stable]
422422
impl<T: Sync + Send> Drop for Weak<T> {
423423
/// Drops the `Weak<T>`.
424424
///

src/liballoc/boxed.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ impl fmt::Show for Box<Any> {
155155
}
156156
}
157157

158+
#[stable]
158159
impl<Sized? T> Deref for Box<T> {
159160
type Target = T;
160161

161162
fn deref(&self) -> &T { &**self }
162163
}
163164

165+
#[stable]
164166
impl<Sized? T> DerefMut for Box<T> {
165167
fn deref_mut(&mut self) -> &mut T { &mut **self }
166168
}

src/liballoc/rc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl<T> BorrowFrom<Rc<T>> for T {
354354
}
355355
}
356356

357-
#[experimental = "Deref is experimental."]
357+
#[stable]
358358
impl<T> Deref for Rc<T> {
359359
type Target = T;
360360

@@ -365,7 +365,7 @@ impl<T> Deref for Rc<T> {
365365
}
366366

367367
#[unsafe_destructor]
368-
#[experimental = "Drop is experimental."]
368+
#[stable]
369369
impl<T> Drop for Rc<T> {
370370
/// Drops the `Rc<T>`.
371371
///
@@ -656,7 +656,7 @@ impl<T> Weak<T> {
656656
}
657657

658658
#[unsafe_destructor]
659-
#[experimental = "Weak pointers may not belong in this module."]
659+
#[stable]
660660
impl<T> Drop for Weak<T> {
661661
/// Drops the `Weak<T>`.
662662
///

src/libcollections/binary_heap.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
//! ```
149149
150150
#![allow(missing_docs)]
151+
#![stable]
151152

152153
use core::prelude::*;
153154

@@ -561,11 +562,13 @@ impl<T: Ord> BinaryHeap<T> {
561562
}
562563

563564
/// `BinaryHeap` iterator.
565+
#[stable]
564566
pub struct Iter <'a, T: 'a> {
565567
iter: slice::Iter<'a, T>,
566568
}
567569

568570
// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
571+
#[stable]
569572
impl<'a, T> Clone for Iter<'a, T> {
570573
fn clone(&self) -> Iter<'a, T> {
571574
Iter { iter: self.iter.clone() }
@@ -593,6 +596,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
593596
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
594597

595598
/// An iterator that moves out of a `BinaryHeap`.
599+
#[stable]
596600
pub struct IntoIter<T> {
597601
iter: vec::IntoIter<T>,
598602
}
@@ -618,6 +622,7 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
618622
impl<T> ExactSizeIterator for IntoIter<T> {}
619623

620624
/// An iterator that drains a `BinaryHeap`.
625+
#[unstable = "recent addition"]
621626
pub struct Drain<'a, T: 'a> {
622627
iter: vec::Drain<'a, T>,
623628
}

src/libcollections/dlist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
// Backlinks over DList::prev are raw pointers that form a full chain in
2020
// the reverse direction.
2121

22+
#![stable]
23+
2224
use core::prelude::*;
2325

2426
use alloc::boxed::Box;

src/libcollections/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,23 @@ pub mod string;
6565
pub mod vec;
6666
pub mod vec_map;
6767

68+
#[stable]
6869
pub mod bitv {
6970
pub use bit::{Bitv, Iter};
7071
}
7172

73+
#[stable]
7274
pub mod bitv_set {
7375
pub use bit::{BitvSet, Union, Intersection, Difference, SymmetricDifference};
7476
pub use bit::SetIter as Iter;
7577
}
7678

79+
#[stable]
7780
pub mod btree_map {
7881
pub use btree::map::*;
7982
}
8083

84+
#[stable]
8185
pub mod btree_set {
8286
pub use btree::set::*;
8387
}
@@ -109,8 +113,7 @@ mod prelude {
109113
pub use core::iter::range;
110114
pub use core::iter::{FromIterator, Extend, IteratorExt};
111115
pub use core::iter::{Iterator, DoubleEndedIterator, RandomAccessIterator};
112-
pub use core::iter::{IteratorCloneExt, CloneIteratorExt};
113-
pub use core::iter::{IteratorOrdExt, MutableDoubleEndedIterator, ExactSizeIterator};
116+
pub use core::iter::{ExactSizeIterator};
114117
pub use core::kinds::{Copy, Send, Sized, Sync};
115118
pub use core::mem::drop;
116119
pub use core::ops::{Drop, Fn, FnMut, FnOnce};

src/libcollections/ring_buf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
//! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are
1313
//! not required to be copyable, and the queue will be sendable if the contained type is sendable.
1414
15+
#![stable]
16+
1517
use core::prelude::*;
1618

1719
use core::cmp::Ordering;

src/libcollections/slice.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
//! * Further iterators exist that split, chunk or permute the slice.
8787
8888
#![doc(primitive = "slice")]
89+
#![stable]
8990

9091
use alloc::boxed::Box;
9192
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
@@ -121,8 +122,10 @@ pub type MutItems<'a, T:'a> = IterMut<'a, T>;
121122
////////////////////////////////////////////////////////////////////////////////
122123

123124
/// Allocating extension methods for slices.
124-
#[unstable = "needs associated types, may merge with other traits"]
125-
pub trait SliceExt<T> for Sized? {
125+
pub trait SliceExt for Sized? {
126+
#[stable]
127+
type Item;
128+
126129
/// Sorts the slice, in place, using `compare` to compare
127130
/// elements.
128131
///
@@ -561,8 +564,10 @@ pub trait SliceExt<T> for Sized? {
561564
fn as_mut_ptr(&mut self) -> *mut T;
562565
}
563566

564-
#[unstable = "trait is unstable"]
565-
impl<T> SliceExt<T> for [T] {
567+
#[stable]
568+
impl<T> SliceExt for [T] {
569+
type Item = T;
570+
566571
#[inline]
567572
fn sort_by<F>(&mut self, compare: F) where F: FnMut(&T, &T) -> Ordering {
568573
merge_sort(self, compare)
@@ -1113,7 +1118,10 @@ struct SizeDirection {
11131118
dir: Direction,
11141119
}
11151120

1116-
impl Iterator<(uint, uint)> for ElementSwaps {
1121+
#[stable]
1122+
impl Iterator for ElementSwaps {
1123+
type Item = (uint, uint);
1124+
11171125
#[inline]
11181126
fn next(&mut self) -> Option<(uint, uint)> {
11191127
fn new_pos(i: uint, s: Direction) -> uint {

src/libcollections/str.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ enum DecompositionType {
165165
/// External iterator for a string's decomposition's characters.
166166
/// Use with the `std::iter` module.
167167
#[derive(Clone)]
168+
#[unstable]
168169
pub struct Decompositions<'a> {
169170
kind: DecompositionType,
170171
iter: Chars<'a>,
171172
buffer: Vec<(char, u8)>,
172173
sorted: bool
173174
}
174175

176+
#[stable]
175177
impl<'a> Iterator for Decompositions<'a> {
176178
type Item = char;
177179

@@ -253,6 +255,7 @@ enum RecompositionState {
253255
/// External iterator for a string's recomposition's characters.
254256
/// Use with the `std::iter` module.
255257
#[derive(Clone)]
258+
#[unstable]
256259
pub struct Recompositions<'a> {
257260
iter: Decompositions<'a>,
258261
state: RecompositionState,
@@ -261,6 +264,7 @@ pub struct Recompositions<'a> {
261264
last_ccc: Option<u8>
262265
}
263266

267+
#[stable]
264268
impl<'a> Iterator for Recompositions<'a> {
265269
type Item = char;
266270

@@ -348,10 +352,12 @@ impl<'a> Iterator for Recompositions<'a> {
348352
/// External iterator for a string's UTF16 codeunits.
349353
/// Use with the `std::iter` module.
350354
#[derive(Clone)]
355+
#[unstable]
351356
pub struct Utf16Units<'a> {
352357
encoder: Utf16Encoder<Chars<'a>>
353358
}
354359

360+
#[stable]
355361
impl<'a> Iterator for Utf16Units<'a> {
356362
type Item = u16;
357363

src/libcollections/string.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ impl fmt::Show for FromUtf16Error {
687687
}
688688
}
689689

690-
#[experimental = "waiting on FromIterator stabilization"]
690+
#[stable]
691691
impl FromIterator<char> for String {
692692
fn from_iter<I:Iterator<Item=char>>(iterator: I) -> String {
693693
let mut buf = String::new();
@@ -696,7 +696,7 @@ impl FromIterator<char> for String {
696696
}
697697
}
698698

699-
#[experimental = "waiting on FromIterator stabilization"]
699+
#[stable]
700700
impl<'a> FromIterator<&'a str> for String {
701701
fn from_iter<I:Iterator<Item=&'a str>>(iterator: I) -> String {
702702
let mut buf = String::new();
@@ -808,7 +808,7 @@ impl<H: hash::Writer> hash::Hash<H> for String {
808808
}
809809
}
810810

811-
#[experimental = "waiting on Add stabilization"]
811+
#[unstable = "recent addition, needs more experience"]
812812
impl<'a> Add<&'a str> for String {
813813
type Output = String;
814814

@@ -840,7 +840,7 @@ impl ops::Slice<uint, str> for String {
840840
}
841841
}
842842

843-
#[experimental = "waiting on Deref stabilization"]
843+
#[stable]
844844
impl ops::Deref for String {
845845
type Target = str;
846846

src/libcollections/vec.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,19 +1251,19 @@ impl<T> ops::SliceMut<uint, [T]> for Vec<T> {
12511251
}
12521252
}
12531253

1254-
#[experimental = "waiting on Deref stability"]
1254+
#[stable]
12551255
impl<T> ops::Deref for Vec<T> {
12561256
type Target = [T];
12571257

12581258
fn deref<'a>(&'a self) -> &'a [T] { self.as_slice() }
12591259
}
12601260

1261-
#[experimental = "waiting on DerefMut stability"]
1261+
#[stable]
12621262
impl<T> ops::DerefMut for Vec<T> {
12631263
fn deref_mut<'a>(&'a mut self) -> &'a mut [T] { self.as_mut_slice() }
12641264
}
12651265

1266-
#[experimental = "waiting on FromIterator stability"]
1266+
#[stable]
12671267
impl<T> FromIterator<T> for Vec<T> {
12681268
#[inline]
12691269
fn from_iter<I:Iterator<Item=T>>(mut iterator: I) -> Vec<T> {
@@ -1393,6 +1393,7 @@ impl<T> AsSlice<T> for Vec<T> {
13931393
}
13941394
}
13951395

1396+
#[unstable = "recent addition, needs more experience"]
13961397
impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
13971398
type Output = Vec<T>;
13981399

@@ -1404,6 +1405,7 @@ impl<'a, T: Clone> Add<&'a [T]> for Vec<T> {
14041405
}
14051406

14061407
#[unsafe_destructor]
1408+
#[stable]
14071409
impl<T> Drop for Vec<T> {
14081410
fn drop(&mut self) {
14091411
// This is (and should always remain) a no-op if the fields are
@@ -1449,6 +1451,7 @@ impl<'a> fmt::Writer for Vec<u8> {
14491451
/// A clone-on-write vector
14501452
pub type CowVec<'a, T> = Cow<'a, Vec<T>, [T]>;
14511453

1454+
#[unstable]
14521455
impl<'a, T> FromIterator<T> for CowVec<'a, T> where T: Clone {
14531456
fn from_iter<I: Iterator<Item=T>>(it: I) -> CowVec<'a, T> {
14541457
Cow::Owned(FromIterator::from_iter(it))
@@ -1494,6 +1497,7 @@ impl<T> IntoIter<T> {
14941497
}
14951498
}
14961499

1500+
#[stable]
14971501
impl<T> Iterator for IntoIter<T> {
14981502
type Item = T;
14991503

@@ -1530,6 +1534,7 @@ impl<T> Iterator for IntoIter<T> {
15301534
}
15311535
}
15321536

1537+
#[stable]
15331538
impl<T> DoubleEndedIterator for IntoIter<T> {
15341539
#[inline]
15351540
fn next_back<'a>(&'a mut self) -> Option<T> {
@@ -1553,9 +1558,11 @@ impl<T> DoubleEndedIterator for IntoIter<T> {
15531558
}
15541559
}
15551560

1561+
#[stable]
15561562
impl<T> ExactSizeIterator for IntoIter<T> {}
15571563

15581564
#[unsafe_destructor]
1565+
#[stable]
15591566
impl<T> Drop for IntoIter<T> {
15601567
fn drop(&mut self) {
15611568
// destroy the remaining elements
@@ -1577,6 +1584,7 @@ pub struct Drain<'a, T> {
15771584
marker: ContravariantLifetime<'a>,
15781585
}
15791586

1587+
#[stable]
15801588
impl<'a, T> Iterator for Drain<'a, T> {
15811589
type Item = T;
15821590

@@ -1613,6 +1621,7 @@ impl<'a, T> Iterator for Drain<'a, T> {
16131621
}
16141622
}
16151623

1624+
#[stable]
16161625
impl<'a, T> DoubleEndedIterator for Drain<'a, T> {
16171626
#[inline]
16181627
fn next_back(&mut self) -> Option<T> {
@@ -1636,9 +1645,11 @@ impl<'a, T> DoubleEndedIterator for Drain<'a, T> {
16361645
}
16371646
}
16381647

1648+
#[stable]
16391649
impl<'a, T> ExactSizeIterator for Drain<'a, T> {}
16401650

16411651
#[unsafe_destructor]
1652+
#[stable]
16421653
impl<'a, T> Drop for Drain<'a, T> {
16431654
fn drop(&mut self) {
16441655
// self.ptr == self.end == null if drop has already been called,
@@ -1671,7 +1682,7 @@ impl<'a, T> Deref for DerefVec<'a, T> {
16711682

16721683
// Prevent the inner `Vec<T>` from attempting to deallocate memory.
16731684
#[unsafe_destructor]
1674-
#[experimental]
1685+
#[stable]
16751686
impl<'a, T> Drop for DerefVec<'a, T> {
16761687
fn drop(&mut self) {
16771688
self.x.len = 0;

0 commit comments

Comments
 (0)