Skip to content

Commit f1e4ed8

Browse files
committed
---
yaml --- r: 151227 b: refs/heads/try2 c: 4baff4e h: refs/heads/master i: 151225: 8549181 151223: 26b7e56 v: v3
1 parent 9a67433 commit f1e4ed8

Some content is hidden

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

63 files changed

+1954
-1656
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: fb72d7cfea9ba44581f708b13aa82ab23ee4fa7e
8+
refs/heads/try2: 4baff4e15f003260de0cc17f419c418332e77149
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: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,12 @@ 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()` 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
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
126126
127127
A typical mutable container will implement at least `iter()`, `mut_iter()` and
128-
`move_iter()`. If it maintains an order, the returned iterators will be
129-
`DoubleEndedIterator`s, which are described below.
128+
`move_iter()` along with the reverse variants if it maintains an order.
130129
131130
### Freezing
132131
@@ -266,7 +265,7 @@ Iterators offer generic conversion to containers with the `collect` adaptor:
266265
267266
~~~
268267
let xs = [0, 1, 1, 2, 3, 5, 8];
269-
let ys = xs.iter().rev().skip(1).map(|&x| x * 2).collect::<~[int]>();
268+
let ys = xs.rev_iter().skip(1).map(|&x| x * 2).collect::<~[int]>();
270269
assert_eq!(ys, ~[10, 6, 4, 2, 2, 0]);
271270
~~~
272271
@@ -359,6 +358,9 @@ for &x in it.rev() {
359358
}
360359
~~~
361360

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+
362364
The `chain`, `map`, `filter`, `filter_map` and `inspect` adaptors are
363365
`DoubleEndedIterator` implementations if the underlying iterators are.
364366

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 elements of both lists are equal, keep going.
1200+
// If the current element in both lists is 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 elements of both lists are equal, keep going.
1307+
// If the current element in both lists is 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 elements of both lists are equal, keep going.
1336+
// If the current element in both lists is 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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,6 @@ impl Bitv {
425425
}
426426

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

branches/try2/src/libcollections/dlist.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 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
373374
#[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,9 +390,8 @@ impl<T> DList<T> {
390390
list: self
391391
}
392392
}
393-
393+
/// Provide a reverse iterator with mutable references
394394
#[inline]
395-
#[deprecated = "replaced by .mut_iter().rev()"]
396395
pub fn mut_rev_iter<'a>(&'a mut self) -> Rev<MutItems<'a, T>> {
397396
self.mut_iter().rev()
398397
}
@@ -404,8 +403,8 @@ impl<T> DList<T> {
404403
MoveItems{list: self}
405404
}
406405

406+
/// Consume the list into an iterator yielding elements by value, in reverse
407407
#[inline]
408-
#[deprecated = "replaced by .move_iter().rev()"]
409408
pub fn move_rev_iter(self) -> Rev<MoveItems<T>> {
410409
self.move_iter().rev()
411410
}
@@ -850,13 +849,13 @@ mod tests {
850849
#[test]
851850
fn test_rev_iter() {
852851
let m = generate_test();
853-
for (i, elt) in m.iter().rev().enumerate() {
852+
for (i, elt) in m.rev_iter().enumerate() {
854853
assert_eq!((6 - i) as int, *elt);
855854
}
856855
let mut n = DList::new();
857-
assert_eq!(n.iter().rev().next(), None);
856+
assert_eq!(n.rev_iter().next(), None);
858857
n.push_front(4);
859-
let mut it = n.iter().rev();
858+
let mut it = n.rev_iter();
860859
assert_eq!(it.size_hint(), (1, Some(1)));
861860
assert_eq!(it.next().unwrap(), &4);
862861
assert_eq!(it.size_hint(), (0, Some(0)));
@@ -959,13 +958,13 @@ mod tests {
959958
#[test]
960959
fn test_mut_rev_iter() {
961960
let mut m = generate_test();
962-
for (i, elt) in m.mut_iter().rev().enumerate() {
961+
for (i, elt) in m.mut_rev_iter().enumerate() {
963962
assert_eq!((6-i) as int, *elt);
964963
}
965964
let mut n = DList::new();
966-
assert!(n.mut_iter().rev().next().is_none());
965+
assert!(n.mut_rev_iter().next().is_none());
967966
n.push_front(4);
968-
let mut it = n.mut_iter().rev();
967+
let mut it = n.mut_rev_iter();
969968
assert!(it.next().is_some());
970969
assert!(it.next().is_none());
971970
}
@@ -1165,15 +1164,15 @@ mod tests {
11651164
let v = &[0, ..128];
11661165
let m: DList<int> = v.iter().map(|&x|x).collect();
11671166
b.iter(|| {
1168-
assert!(m.iter().rev().len() == 128);
1167+
assert!(m.rev_iter().len() == 128);
11691168
})
11701169
}
11711170
#[bench]
11721171
fn bench_iter_mut_rev(b: &mut test::Bencher) {
11731172
let v = &[0, ..128];
11741173
let mut m: DList<int> = v.iter().map(|&x|x).collect();
11751174
b.iter(|| {
1176-
assert!(m.mut_iter().rev().len() == 128);
1175+
assert!(m.mut_rev_iter().len() == 128);
11771176
})
11781177
}
11791178
}

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-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013 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().iter().rev().map(|&x| x).collect();
385+
let mut q: PriorityQueue<uint> = xs.as_slice().rev_iter().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-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 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-
#[deprecated = "replaced by .iter().rev()"]
193+
/// Back-to-front iterator.
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-
#[deprecated = "replaced by .mut_iter().rev()"]
224+
/// Back-to-front iterator which returns mutable values.
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.iter().rev().next(), None);
705+
assert_eq!(d.rev_iter().next(), None);
706706

707707
for i in range(0, 5) {
708708
d.push_back(i);
709709
}
710-
assert_eq!(d.iter().rev().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0]);
710+
assert_eq!(d.rev_iter().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.iter().rev().collect::<Vec<&int>>().as_slice(), &[&4,&3,&2,&1,&0,&6,&7,&8]);
715+
assert_eq!(d.rev_iter().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_iter().rev().next().is_none());
721+
assert!(d.mut_rev_iter().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_iter().rev().map(|x| *x).collect::<Vec<int>>(),
729+
assert_eq!(d.mut_rev_iter().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_iter().rev().next().is_none());
759+
assert!(d.mut_rev_iter().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_iter().rev().enumerate() {
765+
for (i, elt) in d.mut_rev_iter().enumerate() {
766766
assert_eq!(*elt, i);
767767
*elt = i;
768768
}
769769

770770
{
771-
let mut it = d.mut_iter().rev();
771+
let mut it = d.mut_rev_iter();
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: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012 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,13 +142,16 @@ impl<V> SmallIntMap<V> {
142142
}
143143
}
144144

145-
#[deprecated = "replaced by .iter().rev()"]
146-
pub fn rev_iter<'r>(&'r self) -> Rev<Entries<'r, V>> {
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> {
147148
self.iter().rev()
148149
}
149150

150-
#[deprecated = "replaced by .mut_iter().rev()"]
151-
pub fn mut_rev_iter<'r>(&'r mut self) -> Rev<MutEntries<'r, V>> {
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> {
152155
self.mut_iter().rev()
153156
}
154157

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

244247
iterator!(impl Entries -> (uint, &'a T), get_ref)
245248
double_ended_iterator!(impl Entries -> (uint, &'a T), get_ref)
246-
#[deprecated = "replaced by Rev<Entries<'a, T>>"]
247249
pub type RevEntries<'a, T> = Rev<Entries<'a, T>>;
248250

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

255257
iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
256258
double_ended_iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
257-
#[deprecated = "replaced by Rev<MutEntries<'a, T>"]
258259
pub type RevMutEntries<'a, T> = Rev<MutEntries<'a, T>>;
259260

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

388389
assert_eq!(m.iter().size_hint(), (0, Some(11)));
389-
assert_eq!(m.iter().rev().size_hint(), (0, Some(11)));
390+
assert_eq!(m.rev_iter().size_hint(), (0, Some(11)));
390391
assert_eq!(m.mut_iter().size_hint(), (0, Some(11)));
391-
assert_eq!(m.mut_iter().rev().size_hint(), (0, Some(11)));
392+
assert_eq!(m.mut_rev_iter().size_hint(), (0, Some(11)));
392393
}
393394

394395
#[test]
@@ -424,7 +425,7 @@ mod test_map {
424425
assert!(m.insert(6, 10));
425426
assert!(m.insert(10, 11));
426427

427-
let mut it = m.iter().rev();
428+
let mut it = m.rev_iter();
428429
assert_eq!(it.next().unwrap(), (10, &11));
429430
assert_eq!(it.next().unwrap(), (6, &10));
430431
assert_eq!(it.next().unwrap(), (3, &5));
@@ -443,7 +444,7 @@ mod test_map {
443444
assert!(m.insert(6, 10));
444445
assert!(m.insert(10, 11));
445446

446-
for (k, v) in m.mut_iter().rev() {
447+
for (k, v) in m.mut_rev_iter() {
447448
*v += k as int;
448449
}
449450

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.iter().rev() {
398+
for elt in self.children.rev_iter() {
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.iter().rev() {
442+
for elt in an.rev_iter() {
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.iter().rev() {
671+
for n in v.rev_iter() {
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.iter().rev() {
2190+
for s in vs.rev_iter() {
21912191
nums.push(BigInt::from_slice(Minus, *s));
21922192
}
21932193
nums.push(Zero::zero());

0 commit comments

Comments
 (0)