Skip to content

Commit 7dc1cbe

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 167863 b: refs/heads/master c: 1971a24 h: refs/heads/master i: 167861: aa8e8c3 167859: 3e24fd2 167855: f2d46c5 v: v3
1 parent a461f75 commit 7dc1cbe

File tree

12 files changed

+94
-38
lines changed

12 files changed

+94
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6b116bedafe29b7876b95575451c92452a1ec72b
2+
refs/heads/master: 1971a24441dc3ba102bccafdf997dd06f3b5487a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c89417130f042c58adc60012e7cddc4ef70b70b9
55
refs/heads/try: 5204084bd2e46af7cc6e0147430e44dd0d657bbb

trunk/src/libstd/c_str.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,9 @@ pub struct CChars<'a> {
504504
marker: marker::ContravariantLifetime<'a>,
505505
}
506506

507-
impl<'a> Iterator<libc::c_char> for CChars<'a> {
507+
impl<'a> Iterator for CChars<'a> {
508+
type Item = libc::c_char;
509+
508510
fn next(&mut self) -> Option<libc::c_char> {
509511
let ch = unsafe { *self.ptr };
510512
if ch == 0 {

trunk/src/libstd/collections/hash/map.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,37 +1423,49 @@ enum VacantEntryState<K, V, M> {
14231423
}
14241424

14251425
#[stable]
1426-
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
1426+
impl<'a, K, V> Iterator for Iter<'a, K, V> {
1427+
type Item = (&'a K, &'a V);
1428+
14271429
#[inline] fn next(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next() }
14281430
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
14291431
}
14301432

14311433
#[stable]
1432-
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
1434+
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
1435+
type Item = (&'a K, &'a mut V);
1436+
14331437
#[inline] fn next(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next() }
14341438
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
14351439
}
14361440

14371441
#[stable]
1438-
impl<K, V> Iterator<(K, V)> for IntoIter<K, V> {
1442+
impl<K, V> Iterator for IntoIter<K, V> {
1443+
type Item = (K, V);
1444+
14391445
#[inline] fn next(&mut self) -> Option<(K, V)> { self.inner.next() }
14401446
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
14411447
}
14421448

14431449
#[stable]
1444-
impl<'a, K, V> Iterator<&'a K> for Keys<'a, K, V> {
1450+
impl<'a, K, V> Iterator for Keys<'a, K, V> {
1451+
type Item = &'a K;
1452+
14451453
#[inline] fn next(&mut self) -> Option<(&'a K)> { self.inner.next() }
14461454
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
14471455
}
14481456

14491457
#[stable]
1450-
impl<'a, K, V> Iterator<&'a V> for Values<'a, K, V> {
1458+
impl<'a, K, V> Iterator for Values<'a, K, V> {
1459+
type Item = &'a V;
1460+
14511461
#[inline] fn next(&mut self) -> Option<(&'a V)> { self.inner.next() }
14521462
#[inline] fn size_hint(&self) -> (uint, Option<uint>) { self.inner.size_hint() }
14531463
}
14541464

14551465
#[stable]
1456-
impl<'a, K: 'a, V: 'a> Iterator<(K, V)> for Drain<'a, K, V> {
1466+
impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> {
1467+
type Item = (K, V);
1468+
14571469
#[inline]
14581470
fn next(&mut self) -> Option<(K, V)> {
14591471
self.inner.next()
@@ -1511,7 +1523,7 @@ impl<'a, K, V> VacantEntry<'a, K, V> {
15111523

15121524
#[stable]
15131525
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
1514-
fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
1526+
fn from_iter<T: Iterator<Item=(K, V)>>(iter: T) -> HashMap<K, V, H> {
15151527
let lower = iter.size_hint().0;
15161528
let mut map = HashMap::with_capacity_and_hasher(lower, Default::default());
15171529
map.extend(iter);
@@ -1521,7 +1533,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for Has
15211533

15221534
#[stable]
15231535
impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Extend<(K, V)> for HashMap<K, V, H> {
1524-
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
1536+
fn extend<T: Iterator<Item=(K, V)>>(&mut self, mut iter: T) {
15251537
for (k, v) in iter {
15261538
self.insert(k, v);
15271539
}

trunk/src/libstd/collections/hash/set.rs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl<T: Eq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> {
603603

604604
#[stable]
605605
impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> {
606-
fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H> {
606+
fn from_iter<I: Iterator<Item=T>>(iter: I) -> HashSet<T, H> {
607607
let lower = iter.size_hint().0;
608608
let mut set = HashSet::with_capacity_and_hasher(lower, Default::default());
609609
set.extend(iter);
@@ -613,7 +613,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T,
613613

614614
#[stable]
615615
impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Extend<T> for HashSet<T, H> {
616-
fn extend<I: Iterator<T>>(&mut self, mut iter: I) {
616+
fn extend<I: Iterator<Item=T>>(&mut self, mut iter: I) {
617617
for k in iter {
618618
self.insert(k);
619619
}
@@ -789,27 +789,35 @@ pub struct Union<'a, T: 'a, H: 'a> {
789789
}
790790

791791
#[stable]
792-
impl<'a, K> Iterator<&'a K> for Iter<'a, K> {
792+
impl<'a, K> Iterator for Iter<'a, K> {
793+
type Item = &'a K;
794+
793795
fn next(&mut self) -> Option<&'a K> { self.iter.next() }
794796
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
795797
}
796798

797799
#[stable]
798-
impl<K> Iterator<K> for IntoIter<K> {
800+
impl<K> Iterator for IntoIter<K> {
801+
type Item = K;
802+
799803
fn next(&mut self) -> Option<K> { self.iter.next() }
800804
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
801805
}
802806

803807
#[stable]
804-
impl<'a, K: 'a> Iterator<K> for Drain<'a, K> {
808+
impl<'a, K: 'a> Iterator for Drain<'a, K> {
809+
type Item = K;
810+
805811
fn next(&mut self) -> Option<K> { self.iter.next() }
806812
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
807813
}
808814

809815
#[stable]
810-
impl<'a, T, S, H> Iterator<&'a T> for Intersection<'a, T, H>
816+
impl<'a, T, S, H> Iterator for Intersection<'a, T, H>
811817
where T: Eq + Hash<S>, H: Hasher<S>
812818
{
819+
type Item = &'a T;
820+
813821
fn next(&mut self) -> Option<&'a T> {
814822
loop {
815823
match self.iter.next() {
@@ -828,9 +836,11 @@ impl<'a, T, S, H> Iterator<&'a T> for Intersection<'a, T, H>
828836
}
829837

830838
#[stable]
831-
impl<'a, T, S, H> Iterator<&'a T> for Difference<'a, T, H>
839+
impl<'a, T, S, H> Iterator for Difference<'a, T, H>
832840
where T: Eq + Hash<S>, H: Hasher<S>
833841
{
842+
type Item = &'a T;
843+
834844
fn next(&mut self) -> Option<&'a T> {
835845
loop {
836846
match self.iter.next() {
@@ -849,17 +859,21 @@ impl<'a, T, S, H> Iterator<&'a T> for Difference<'a, T, H>
849859
}
850860

851861
#[stable]
852-
impl<'a, T, S, H> Iterator<&'a T> for SymmetricDifference<'a, T, H>
862+
impl<'a, T, S, H> Iterator for SymmetricDifference<'a, T, H>
853863
where T: Eq + Hash<S>, H: Hasher<S>
854864
{
865+
type Item = &'a T;
866+
855867
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
856868
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
857869
}
858870

859871
#[stable]
860-
impl<'a, T, S, H> Iterator<&'a T> for Union<'a, T, H>
872+
impl<'a, T, S, H> Iterator for Union<'a, T, H>
861873
where T: Eq + Hash<S>, H: Hasher<S>
862874
{
875+
type Item = &'a T;
876+
863877
fn next(&mut self) -> Option<&'a T> { self.iter.next() }
864878
fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
865879
}

trunk/src/libstd/collections/hash/table.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,9 @@ impl<'a, K, V> Clone for RawBuckets<'a, K, V> {
730730
}
731731

732732

733-
impl<'a, K, V> Iterator<RawBucket<K, V>> for RawBuckets<'a, K, V> {
733+
impl<'a, K, V> Iterator for RawBuckets<'a, K, V> {
734+
type Item = RawBucket<K, V>;
735+
734736
fn next(&mut self) -> Option<RawBucket<K, V>> {
735737
while self.raw.hash != self.hashes_end {
736738
unsafe {
@@ -757,7 +759,9 @@ struct RevMoveBuckets<'a, K, V> {
757759
marker: marker::ContravariantLifetime<'a>,
758760
}
759761

760-
impl<'a, K, V> Iterator<(K, V)> for RevMoveBuckets<'a, K, V> {
762+
impl<'a, K, V> Iterator for RevMoveBuckets<'a, K, V> {
763+
type Item = (K, V);
764+
761765
fn next(&mut self) -> Option<(K, V)> {
762766
if self.elems_left == 0 {
763767
return None;
@@ -816,7 +820,9 @@ pub struct Drain<'a, K: 'a, V: 'a> {
816820
iter: RawBuckets<'static, K, V>,
817821
}
818822

819-
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
823+
impl<'a, K, V> Iterator for Iter<'a, K, V> {
824+
type Item = (&'a K, &'a V);
825+
820826
fn next(&mut self) -> Option<(&'a K, &'a V)> {
821827
self.iter.next().map(|bucket| {
822828
self.elems_left -= 1;
@@ -832,7 +838,9 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Iter<'a, K, V> {
832838
}
833839
}
834840

835-
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
841+
impl<'a, K, V> Iterator for IterMut<'a, K, V> {
842+
type Item = (&'a K, &'a mut V);
843+
836844
fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
837845
self.iter.next().map(|bucket| {
838846
self.elems_left -= 1;
@@ -848,7 +856,9 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for IterMut<'a, K, V> {
848856
}
849857
}
850858

851-
impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> {
859+
impl<K, V> Iterator for IntoIter<K, V> {
860+
type Item = (SafeHash, K, V);
861+
852862
fn next(&mut self) -> Option<(SafeHash, K, V)> {
853863
self.iter.next().map(|bucket| {
854864
self.table.size -= 1;
@@ -870,7 +880,9 @@ impl<K, V> Iterator<(SafeHash, K, V)> for IntoIter<K, V> {
870880
}
871881
}
872882

873-
impl<'a, K: 'a, V: 'a> Iterator<(SafeHash, K, V)> for Drain<'a, K, V> {
883+
impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> {
884+
type Item = (SafeHash, K, V);
885+
874886
#[inline]
875887
fn next(&mut self) -> Option<(SafeHash, K, V)> {
876888
self.iter.next().map(|bucket| {

trunk/src/libstd/io/extensions.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ impl<'r, R: Reader> Bytes<'r, R> {
5252
}
5353
}
5454

55-
impl<'r, R: Reader> Iterator<IoResult<u8>> for Bytes<'r, R> {
55+
impl<'r, R: Reader> Iterator for Bytes<'r, R> {
56+
type Item = IoResult<u8>;
57+
5658
#[inline]
5759
fn next(&mut self) -> Option<IoResult<u8>> {
5860
match self.reader.read_byte() {

trunk/src/libstd/io/fs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,9 @@ pub struct Directories {
563563
stack: Vec<Path>,
564564
}
565565

566-
impl Iterator<Path> for Directories {
566+
impl Iterator for Directories {
567+
type Item = Path;
568+
567569
fn next(&mut self) -> Option<Path> {
568570
match self.stack.pop() {
569571
Some(path) => {

trunk/src/libstd/io/mod.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,9 @@ pub struct Lines<'r, T:'r> {
13711371
buffer: &'r mut T,
13721372
}
13731373

1374-
impl<'r, T: Buffer> Iterator<IoResult<String>> for Lines<'r, T> {
1374+
impl<'r, T: Buffer> Iterator for Lines<'r, T> {
1375+
type Item = IoResult<String>;
1376+
13751377
fn next(&mut self) -> Option<IoResult<String>> {
13761378
match self.buffer.read_line() {
13771379
Ok(x) => Some(Ok(x)),
@@ -1398,7 +1400,9 @@ pub struct Chars<'r, T:'r> {
13981400
buffer: &'r mut T
13991401
}
14001402

1401-
impl<'r, T: Buffer> Iterator<IoResult<char>> for Chars<'r, T> {
1403+
impl<'r, T: Buffer> Iterator for Chars<'r, T> {
1404+
type Item = IoResult<char>;
1405+
14021406
fn next(&mut self) -> Option<IoResult<char>> {
14031407
match self.buffer.read_char() {
14041408
Ok(x) => Some(Ok(x)),
@@ -1649,14 +1653,18 @@ pub struct IncomingConnections<'a, Sized? A:'a> {
16491653
}
16501654

16511655
#[cfg(stage0)]
1652-
impl<'a, T, A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
1656+
impl<'a, T, A: Acceptor<T>> Iterator for IncomingConnections<'a, A> {
1657+
type Item = IoResult<T>;
1658+
16531659
fn next(&mut self) -> Option<IoResult<T>> {
16541660
Some(self.inc.accept())
16551661
}
16561662
}
16571663

16581664
#[cfg(not(stage0))]
1659-
impl<'a, T, Sized? A: Acceptor<T>> Iterator<IoResult<T>> for IncomingConnections<'a, A> {
1665+
impl<'a, T, Sized? A: Acceptor<T>> Iterator for IncomingConnections<'a, A> {
1666+
type Item = IoResult<T>;
1667+
16601668
fn next(&mut self) -> Option<IoResult<T>> {
16611669
Some(self.inc.accept())
16621670
}

trunk/src/libstd/io/util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ pub struct ChainedReader<I, R> {
169169
cur_reader: Option<R>,
170170
}
171171

172-
impl<R: Reader, I: Iterator<R>> ChainedReader<I, R> {
172+
impl<R: Reader, I: Iterator<Item=R>> ChainedReader<I, R> {
173173
/// Creates a new `ChainedReader`
174174
pub fn new(mut readers: I) -> ChainedReader<I, R> {
175175
let r = readers.next();
176176
ChainedReader { readers: readers, cur_reader: r }
177177
}
178178
}
179179

180-
impl<R: Reader, I: Iterator<R>> Reader for ChainedReader<I, R> {
180+
impl<R: Reader, I: Iterator<Item=R>> Reader for ChainedReader<I, R> {
181181
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
182182
loop {
183183
let err = match self.cur_reader {
@@ -252,15 +252,15 @@ pub struct IterReader<T> {
252252
iter: T,
253253
}
254254

255-
impl<T: Iterator<u8>> IterReader<T> {
255+
impl<T: Iterator<Item=u8>> IterReader<T> {
256256
/// Creates a new `IterReader` which will read from the specified
257257
/// `Iterator`.
258258
pub fn new(iter: T) -> IterReader<T> {
259259
IterReader { iter: iter }
260260
}
261261
}
262262

263-
impl<T: Iterator<u8>> Reader for IterReader<T> {
263+
impl<T: Iterator<Item=u8>> Reader for IterReader<T> {
264264
#[inline]
265265
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
266266
let mut len = 0;

trunk/src/libstd/rand/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ pub fn random<T: Rand>() -> T {
404404
/// let sample = sample(&mut rng, range(1i, 100), 5);
405405
/// println!("{}", sample);
406406
/// ```
407-
pub fn sample<T, I: Iterator<T>, R: Rng>(rng: &mut R,
407+
pub fn sample<T, I: Iterator<Item=T>, R: Rng>(rng: &mut R,
408408
mut iter: I,
409409
amount: uint) -> Vec<T> {
410410
let mut reservoir: Vec<T> = iter.by_ref().take(amount).collect();

trunk/src/libstd/sync/mpsc/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,9 @@ impl<T: Send> select::Packet for Receiver<T> {
936936
}
937937

938938
#[unstable]
939-
impl<'a, T: Send> Iterator<T> for Iter<'a, T> {
939+
impl<'a, T: Send> Iterator for Iter<'a, T> {
940+
type Item = T;
941+
940942
fn next(&mut self) -> Option<T> { self.rx.recv().ok() }
941943
}
942944

trunk/src/libstd/sync/mpsc/select.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ impl<'rx, T: Send> Drop for Handle<'rx, T> {
319319
}
320320
}
321321

322-
impl Iterator<*mut Handle<'static, ()>> for Packets {
322+
impl Iterator for Packets {
323+
type Item = *mut Handle<'static, ()>;
324+
323325
fn next(&mut self) -> Option<*mut Handle<'static, ()>> {
324326
if self.cur.is_null() {
325327
None

0 commit comments

Comments
 (0)