Skip to content

Commit d5c9c9f

Browse files
committed
---
yaml --- r: 151230 b: refs/heads/try2 c: 9f836d5 h: refs/heads/master v: v3
1 parent cf3eb18 commit d5c9c9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1584
-1896
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e93cb04c4b011088d3b13a17bdf4cb865730dd38
8+
refs/heads/try2: 9f836d5a53e20fde65aa3469fa1826228e7c273a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-container.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,13 @@ differently.
120120
Containers implement iteration over the contained elements by returning an
121121
iterator object. For example, vector slices several iterators available:
122122
123-
* `iter()` and `rev_iter()`, for immutable references to the elements
124-
* `mut_iter()` and `mut_rev_iter()`, for mutable references to the elements
125-
* `move_iter()` and `move_rev_iter()`, to move the elements out by-value
123+
* `iter()` for immutable references to the elements
124+
* `mut_iter()` for mutable references to the elements
125+
* `move_iter()` to move the elements out by-value
126126
127127
A typical mutable container will implement at least `iter()`, `mut_iter()` and
128-
`move_iter()` along with the reverse variants if it maintains an order.
128+
`move_iter()`. If it maintains an order, the returned iterators will be
129+
`DoubleEndedIterator`s, which are described below.
129130
130131
### Freezing
131132
@@ -265,7 +266,7 @@ Iterators offer generic conversion to containers with the `collect` adaptor:
265266
266267
~~~
267268
let xs = [0, 1, 1, 2, 3, 5, 8];
268-
let ys = xs.rev_iter().skip(1).map(|&x| x * 2).collect::<~[int]>();
269+
let ys = xs.iter().rev().skip(1).map(|&x| x * 2).collect::<~[int]>();
269270
assert_eq!(ys, ~[10, 6, 4, 2, 2, 0]);
270271
~~~
271272
@@ -358,9 +359,6 @@ for &x in it.rev() {
358359
}
359360
~~~
360361

361-
The `rev_iter` and `mut_rev_iter` methods on vectors just return an inverted
362-
version of the standard immutable and mutable vector iterators.
363-
364362
The `chain`, `map`, `filter`, `filter_map` and `inspect` adaptors are
365363
`DoubleEndedIterator` implementations if the underlying iterators are.
366364

branches/try2/src/doc/tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ fn eq(xs: &List, ys: &List) -> bool {
11971197
match (xs, ys) {
11981198
// If we have reached the end of both lists, they are equal.
11991199
(&Nil, &Nil) => true,
1200-
// If the current element in both lists is equal, keep going.
1200+
// If the current elements of both lists are equal, keep going.
12011201
(&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys))
12021202
if x == y => eq(next_xs, next_ys),
12031203
// If the current elements are not equal, the lists are not equal.
@@ -1304,7 +1304,7 @@ fn eq<T: Eq>(xs: &List<T>, ys: &List<T>) -> bool {
13041304
match (xs, ys) {
13051305
// If we have reached the end of both lists, they are equal.
13061306
(&Nil, &Nil) => true,
1307-
// If the current element in both lists is equal, keep going.
1307+
// If the current elements of both lists are equal, keep going.
13081308
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys))
13091309
if x == y => eq(next_xs, next_ys),
13101310
// If the current elements are not equal, the lists are not equal.
@@ -1333,7 +1333,7 @@ impl<T: Eq> Eq for List<T> {
13331333
match (self, ys) {
13341334
// If we have reached the end of both lists, they are equal.
13351335
(&Nil, &Nil) => true,
1336-
// If the current element in both lists is equal, keep going.
1336+
// If the current elements of both lists are equal, keep going.
13371337
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys))
13381338
if x == y => next_xs == next_ys,
13391339
// If the current elements are not equal, the lists are not equal.
@@ -2965,7 +2965,7 @@ use farm::*;
29652965
~~~
29662966

29672967
> *Note:* This feature of the compiler is currently gated behind the
2968-
> `#[feature(globs)]` directive. More about these directives can be found in
2968+
> `#![feature(globs)]` directive. More about these directives can be found in
29692969
> the manual.
29702970
29712971
However, that's not all. You can also rename an item while you're bringing it into scope:

branches/try2/src/libcollections/bitv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ impl Bitv {
425425
}
426426

427427
#[inline]
428+
#[deprecated = "replaced by .iter().rev()"]
428429
pub fn rev_iter<'a>(&'a self) -> Rev<Bits<'a>> {
429430
self.iter().rev()
430431
}

branches/try2/src/libcollections/dlist.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -370,8 +370,8 @@ impl<T> DList<T> {
370370
Items{nelem: self.len(), head: &self.list_head, tail: self.list_tail}
371371
}
372372

373-
/// Provide a reverse iterator
374373
#[inline]
374+
#[deprecated = "replaced by .iter().rev()"]
375375
pub fn rev_iter<'a>(&'a self) -> Rev<Items<'a, T>> {
376376
self.iter().rev()
377377
}
@@ -390,8 +390,9 @@ impl<T> DList<T> {
390390
list: self
391391
}
392392
}
393-
/// Provide a reverse iterator with mutable references
393+
394394
#[inline]
395+
#[deprecated = "replaced by .mut_iter().rev()"]
395396
pub fn mut_rev_iter<'a>(&'a mut self) -> Rev<MutItems<'a, T>> {
396397
self.mut_iter().rev()
397398
}
@@ -403,8 +404,8 @@ impl<T> DList<T> {
403404
MoveItems{list: self}
404405
}
405406

406-
/// Consume the list into an iterator yielding elements by value, in reverse
407407
#[inline]
408+
#[deprecated = "replaced by .move_iter().rev()"]
408409
pub fn move_rev_iter(self) -> Rev<MoveItems<T>> {
409410
self.move_iter().rev()
410411
}
@@ -849,13 +850,13 @@ mod tests {
849850
#[test]
850851
fn test_rev_iter() {
851852
let m = generate_test();
852-
for (i, elt) in m.rev_iter().enumerate() {
853+
for (i, elt) in m.iter().rev().enumerate() {
853854
assert_eq!((6 - i) as int, *elt);
854855
}
855856
let mut n = DList::new();
856-
assert_eq!(n.rev_iter().next(), None);
857+
assert_eq!(n.iter().rev().next(), None);
857858
n.push_front(4);
858-
let mut it = n.rev_iter();
859+
let mut it = n.iter().rev();
859860
assert_eq!(it.size_hint(), (1, Some(1)));
860861
assert_eq!(it.next().unwrap(), &4);
861862
assert_eq!(it.size_hint(), (0, Some(0)));
@@ -958,13 +959,13 @@ mod tests {
958959
#[test]
959960
fn test_mut_rev_iter() {
960961
let mut m = generate_test();
961-
for (i, elt) in m.mut_rev_iter().enumerate() {
962+
for (i, elt) in m.mut_iter().rev().enumerate() {
962963
assert_eq!((6-i) as int, *elt);
963964
}
964965
let mut n = DList::new();
965-
assert!(n.mut_rev_iter().next().is_none());
966+
assert!(n.mut_iter().rev().next().is_none());
966967
n.push_front(4);
967-
let mut it = n.mut_rev_iter();
968+
let mut it = n.mut_iter().rev();
968969
assert!(it.next().is_some());
969970
assert!(it.next().is_none());
970971
}
@@ -1164,15 +1165,15 @@ mod tests {
11641165
let v = &[0, ..128];
11651166
let m: DList<int> = v.iter().map(|&x|x).collect();
11661167
b.iter(|| {
1167-
assert!(m.rev_iter().len() == 128);
1168+
assert!(m.iter().rev().len() == 128);
11681169
})
11691170
}
11701171
#[bench]
11711172
fn bench_iter_mut_rev(b: &mut test::Bencher) {
11721173
let v = &[0, ..128];
11731174
let mut m: DList<int> = v.iter().map(|&x|x).collect();
11741175
b.iter(|| {
1175-
assert!(m.mut_rev_iter().len() == 128);
1176+
assert!(m.mut_iter().rev().len() == 128);
11761177
})
11771178
}
11781179
}

branches/try2/src/libcollections/priority_queue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -382,7 +382,7 @@ mod tests {
382382
fn test_from_iter() {
383383
let xs = vec!(9u, 8, 7, 6, 5, 4, 3, 2, 1);
384384

385-
let mut q: PriorityQueue<uint> = xs.as_slice().rev_iter().map(|&x| x).collect();
385+
let mut q: PriorityQueue<uint> = xs.as_slice().iter().rev().map(|&x| x).collect();
386386

387387
for &x in xs.iter() {
388388
assert_eq!(q.pop(), x);

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -190,7 +190,7 @@ impl<T> RingBuf<T> {
190190
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
191191
}
192192

193-
/// Back-to-front iterator.
193+
#[deprecated = "replaced by .iter().rev()"]
194194
pub fn rev_iter<'a>(&'a self) -> Rev<Items<'a, T>> {
195195
self.iter().rev()
196196
}
@@ -221,7 +221,7 @@ impl<T> RingBuf<T> {
221221
}
222222
}
223223

224-
/// Back-to-front iterator which returns mutable values.
224+
#[deprecated = "replaced by .mut_iter().rev()"]
225225
pub fn mut_rev_iter<'a>(&'a mut self) -> Rev<MutItems<'a, T>> {
226226
self.mut_iter().rev()
227227
}
@@ -702,31 +702,31 @@ mod tests {
702702
#[test]
703703
fn test_rev_iter() {
704704
let mut d = RingBuf::new();
705-
assert_eq!(d.rev_iter().next(), None);
705+
assert_eq!(d.iter().rev().next(), None);
706706

707707
for i in range(0, 5) {
708708
d.push_back(i);
709709
}
710-
assert_eq!(d.rev_iter().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0]);
710+
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0]);
711711

712712
for i in range(6, 9) {
713713
d.push_front(i);
714714
}
715-
assert_eq!(d.rev_iter().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0,&6,&7,&8]);
715+
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0,&6,&7,&8]);
716716
}
717717

718718
#[test]
719719
fn test_mut_rev_iter_wrap() {
720720
let mut d = RingBuf::with_capacity(3);
721-
assert!(d.mut_rev_iter().next().is_none());
721+
assert!(d.mut_iter().rev().next().is_none());
722722

723723
d.push_back(1);
724724
d.push_back(2);
725725
d.push_back(3);
726726
assert_eq!(d.pop_front(), Some(1));
727727
d.push_back(4);
728728

729-
assert_eq!(d.mut_rev_iter().map(|x| *x).collect::<Vec<int>>(),
729+
assert_eq!(d.mut_iter().rev().map(|x| *x).collect::<Vec<int>>(),
730730
vec!(4, 3, 2));
731731
}
732732

@@ -756,19 +756,19 @@ mod tests {
756756
#[test]
757757
fn test_mut_rev_iter() {
758758
let mut d = RingBuf::new();
759-
assert!(d.mut_rev_iter().next().is_none());
759+
assert!(d.mut_iter().rev().next().is_none());
760760

761761
for i in range(0u, 3) {
762762
d.push_front(i);
763763
}
764764

765-
for (i, elt) in d.mut_rev_iter().enumerate() {
765+
for (i, elt) in d.mut_iter().rev().enumerate() {
766766
assert_eq!(*elt, i);
767767
*elt = i;
768768
}
769769

770770
{
771-
let mut it = d.mut_rev_iter();
771+
let mut it = d.mut_iter().rev();
772772
assert_eq!(*it.next().unwrap(), 0);
773773
assert_eq!(*it.next().unwrap(), 1);
774774
assert_eq!(*it.next().unwrap(), 2);

branches/try2/src/libcollections/smallintmap.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -142,16 +142,13 @@ impl<V> SmallIntMap<V> {
142142
}
143143
}
144144

145-
/// An iterator visiting all key-value pairs in descending order by the keys.
146-
/// Iterator element type is (uint, &'r V)
147-
pub fn rev_iter<'r>(&'r self) -> RevEntries<'r, V> {
145+
#[deprecated = "replaced by .iter().rev()"]
146+
pub fn rev_iter<'r>(&'r self) -> Rev<Entries<'r, V>> {
148147
self.iter().rev()
149148
}
150149

151-
/// An iterator visiting all key-value pairs in descending order by the keys,
152-
/// with mutable references to the values
153-
/// Iterator element type is (uint, &'r mut V)
154-
pub fn mut_rev_iter<'r>(&'r mut self) -> RevMutEntries <'r, V> {
150+
#[deprecated = "replaced by .mut_iter().rev()"]
151+
pub fn mut_rev_iter<'r>(&'r mut self) -> Rev<MutEntries<'r, V>> {
155152
self.mut_iter().rev()
156153
}
157154

@@ -246,6 +243,7 @@ pub struct Entries<'a, T> {
246243

247244
iterator!(impl Entries -> (uint, &'a T), get_ref)
248245
double_ended_iterator!(impl Entries -> (uint, &'a T), get_ref)
246+
#[deprecated = "replaced by Rev<Entries<'a, T>>"]
249247
pub type RevEntries<'a, T> = Rev<Entries<'a, T>>;
250248

251249
pub struct MutEntries<'a, T> {
@@ -256,6 +254,7 @@ pub struct MutEntries<'a, T> {
256254

257255
iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
258256
double_ended_iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
257+
#[deprecated = "replaced by Rev<MutEntries<'a, T>"]
259258
pub type RevMutEntries<'a, T> = Rev<MutEntries<'a, T>>;
260259

261260
#[cfg(test)]
@@ -387,9 +386,9 @@ mod test_map {
387386
assert!(m.insert(10, 11));
388387

389388
assert_eq!(m.iter().size_hint(), (0, Some(11)));
390-
assert_eq!(m.rev_iter().size_hint(), (0, Some(11)));
389+
assert_eq!(m.iter().rev().size_hint(), (0, Some(11)));
391390
assert_eq!(m.mut_iter().size_hint(), (0, Some(11)));
392-
assert_eq!(m.mut_rev_iter().size_hint(), (0, Some(11)));
391+
assert_eq!(m.mut_iter().rev().size_hint(), (0, Some(11)));
393392
}
394393

395394
#[test]
@@ -425,7 +424,7 @@ mod test_map {
425424
assert!(m.insert(6, 10));
426425
assert!(m.insert(10, 11));
427426

428-
let mut it = m.rev_iter();
427+
let mut it = m.iter().rev();
429428
assert_eq!(it.next().unwrap(), (10, &11));
430429
assert_eq!(it.next().unwrap(), (6, &10));
431430
assert_eq!(it.next().unwrap(), (3, &5));
@@ -444,7 +443,7 @@ mod test_map {
444443
assert!(m.insert(6, 10));
445444
assert!(m.insert(10, 11));
446445

447-
for (k, v) in m.mut_rev_iter() {
446+
for (k, v) in m.mut_iter().rev() {
448447
*v += k as int;
449448
}
450449

branches/try2/src/libcollections/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ impl<T> TrieNode<T> {
395395

396396
impl<T> TrieNode<T> {
397397
fn each_reverse<'a>(&'a self, f: |&uint, &'a T| -> bool) -> bool {
398-
for elt in self.children.rev_iter() {
398+
for elt in self.children.iter().rev() {
399399
match *elt {
400400
Internal(ref x) => if !x.each_reverse(|i,t| f(i,t)) { return false },
401401
External(k, ref v) => if !f(&k, v) { return false },

branches/try2/src/libnum/bigint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl Integer for BigUint {
439439
let bn = *b.data.last().unwrap();
440440
let mut d = Vec::with_capacity(an.len());
441441
let mut carry = 0;
442-
for elt in an.rev_iter() {
442+
for elt in an.iter().rev() {
443443
let ai = BigDigit::to_uint(carry, *elt);
444444
let di = ai / (bn as uint);
445445
assert!(di < BigDigit::base);
@@ -668,7 +668,7 @@ impl ToStrRadix for BigUint {
668668
fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> ~str {
669669
if v.is_empty() { return "0".to_owned() }
670670
let mut s = StrBuf::with_capacity(v.len() * l);
671-
for n in v.rev_iter() {
671+
for n in v.iter().rev() {
672672
let ss = (*n as uint).to_str_radix(radix);
673673
s.push_str("0".repeat(l - ss.len()));
674674
s.push_str(ss);
@@ -2187,7 +2187,7 @@ mod bigint_tests {
21872187
fn test_cmp() {
21882188
let vs = [ &[2 as BigDigit], &[1, 1], &[2, 1], &[1, 1, 1] ];
21892189
let mut nums = Vec::new();
2190-
for s in vs.rev_iter() {
2190+
for s in vs.iter().rev() {
21912191
nums.push(BigInt::from_slice(Minus, *s));
21922192
}
21932193
nums.push(Zero::zero());

0 commit comments

Comments
 (0)