From 8693943676487c01fa09f5f3daf0df6a1f71e24d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 8 Aug 2013 11:38:10 -0700 Subject: 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::::new()` syntax. --- src/libstd/iterator.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/libstd/iterator.rs') 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 { impl + Zero, T: Iterator> AdditiveIterator for T { #[inline] - fn sum(&mut self) -> A { self.fold(Zero::zero::(), |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 { impl + One, T: Iterator> MultiplicativeIterator for T { #[inline] - fn product(&mut self) -> A { self.fold(One::one::(), |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. -- cgit 1.4.1-3-g733a5