Skip to content

Commit 45edb94

Browse files
committed
---
yaml --- r: 57191 b: refs/heads/try c: 48c2418 h: refs/heads/master i: 57189: dc7007e 57187: 7a948a3 57183: 814e2d3 v: v3
1 parent d10278d commit 45edb94

File tree

14 files changed

+1137
-337
lines changed

14 files changed

+1137
-337
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: 1d53babd2f23439975518fda94d9122b15e779c9
5+
refs/heads/try: 48c24188f9191888110ebea2bc5193de9a0b26d5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/core.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ pub use kinds::{Const, Copy, Owned, Durable};
7777
pub use ops::{Drop};
7878
#[cfg(stage0)]
7979
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
80-
#[cfg(stage1)]
81-
#[cfg(stage2)]
82-
#[cfg(stage3)]
80+
#[cfg(not(stage0))]
8381
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
8482
pub use ops::{BitAnd, BitOr, BitXor};
8583
pub use ops::{Shl, Shr, Index};
@@ -105,7 +103,9 @@ pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
105103
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
106104
pub use iter::{ExtendedMutableIter};
107105

108-
pub use num::{Num, Signed, Unsigned, Natural, NumCast};
106+
pub use num::{Num, NumCast};
107+
pub use num::{Signed, Unsigned, Integer};
108+
pub use num::{Round, Fractional, Real, RealExt};
109109
pub use ptr::Ptr;
110110
pub use to_str::ToStr;
111111
pub use clone::Clone;

branches/try/src/libcore/iterator.rs

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -312,19 +312,6 @@ impl<A, T: Iterator<A>> Iterator<A> for TakeIterator<T> {
312312
}
313313
}
314314

315-
pub struct ScanIterator<'self, A, B, T, St> {
316-
priv iter: T,
317-
priv f: &'self fn(&mut St, A) -> Option<B>,
318-
state: St
319-
}
320-
321-
impl<'self, A, B, T: Iterator<A>, St> Iterator<B> for ScanIterator<'self, A, B, T, St> {
322-
#[inline]
323-
fn next(&mut self) -> Option<B> {
324-
self.iter.next().chain(|a| (self.f)(&mut self.state, a))
325-
}
326-
}
327-
328315
pub struct UnfoldrIterator<'self, A, St> {
329316
priv f: &'self fn(&mut St) -> Option<A>,
330317
state: St
@@ -348,25 +335,16 @@ impl<'self, A, St> Iterator<A> for UnfoldrIterator<'self, A, St> {
348335
}
349336
}
350337

351-
/// An infinite iterator starting at `start` and advancing by `step` with each iteration
352-
pub struct Counter<A> {
353-
state: A,
354-
step: A
355-
}
356-
357-
pub impl<A> Counter<A> {
358-
#[inline(always)]
359-
fn new(start: A, step: A) -> Counter<A> {
360-
Counter{state: start, step: step}
361-
}
338+
pub struct ScanIterator<'self, A, B, T, St> {
339+
priv iter: T,
340+
priv f: &'self fn(&mut St, A) -> Option<B>,
341+
state: St
362342
}
363343

364-
impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
365-
#[inline(always)]
366-
fn next(&mut self) -> Option<A> {
367-
let result = self.state.clone();
368-
self.state = self.state.add(&self.step); // FIXME: #6050
369-
Some(result)
344+
impl<'self, A, B, T: Iterator<A>, St> Iterator<B> for ScanIterator<'self, A, B, T, St> {
345+
#[inline]
346+
fn next(&mut self) -> Option<B> {
347+
self.iter.next().chain(|a| (self.f)(&mut self.state, a))
370348
}
371349
}
372350

@@ -375,13 +353,6 @@ mod tests {
375353
use super::*;
376354
use prelude::*;
377355

378-
#[test]
379-
fn test_counter_to_vec() {
380-
let mut it = Counter::new(0, 5).take(10);
381-
let xs = iter::iter_to_vec(|f| it.advance(f));
382-
assert_eq!(xs, ~[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
383-
}
384-
385356
#[test]
386357
fn test_iterator_chain() {
387358
let xs = [0u, 1, 2, 3, 4, 5];

0 commit comments

Comments
 (0)