diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-08-08 11:38:10 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-08-27 18:47:57 -0700 |
| commit | 8693943676487c01fa09f5f3daf0df6a1f71e24d (patch) | |
| tree | 5aa978e4144d51f320d069d88fe0fad4ed40705e /src/libstd/iterator.rs | |
| parent | 3b6314c39bfc13b5a41c53f13c3fafa7ad91e062 (diff) | |
| download | rust-8693943676487c01fa09f5f3daf0df6a1f71e24d.tar.gz rust-8693943676487c01fa09f5f3daf0df6a1f71e24d.zip | |
librustc: Ensure that type parameters are in the right positions in paths.
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
Diffstat (limited to 'src/libstd/iterator.rs')
| -rw-r--r-- | src/libstd/iterator.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs index 1af49ecd208..4af7b3e2425 100644 --- a/src/libstd/iterator.rs +++ b/src/libstd/iterator.rs @@ -660,7 +660,10 @@ pub trait AdditiveIterator<A> { impl<A: Add<A, A> + Zero, T: Iterator<A>> AdditiveIterator<A> for T { #[inline] - fn sum(&mut self) -> A { self.fold(Zero::zero::<A>(), |s, x| s + x) } + fn sum(&mut self) -> A { + let zero: A = Zero::zero(); + self.fold(zero, |s, x| s + x) + } } /// A trait for iterators over elements whose elements can be multiplied @@ -685,7 +688,10 @@ pub trait MultiplicativeIterator<A> { impl<A: Mul<A, A> + One, T: Iterator<A>> MultiplicativeIterator<A> for T { #[inline] - fn product(&mut self) -> A { self.fold(One::one::<A>(), |p, x| p * x) } + fn product(&mut self) -> A { + let one: A = One::one(); + self.fold(one, |p, x| p * x) + } } /// A trait for iterators over elements which can be compared to one another. |
