From c2fe28890023ab1a94049b8d0c00207cd235e425 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 12 Apr 2012 21:58:32 -0700 Subject: [PATCH] change to use && mode (can't move from upvar) relevant to #1965 --- src/libcore/iter.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 1eca3daa18c..7b1bffaada1 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -81,20 +81,20 @@ fn flat_map,IB:iterable>( } } -fn foldl>(self: IA, +b0: B, blk: fn(-B, A) -> B) -> B { +fn foldl>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B { let mut b <- b0; self.iter {|a| - b = blk(b, a); + b <- blk(b, a); } ret b; } fn foldr>( - self: IA, +b0: B, blk: fn(A, -B) -> B) -> B { + self: IA, +b0: B, blk: fn(A, B) -> B) -> B { let mut b <- b0; reversed(self) {|a| - b = blk(a, b); + b <- blk(a, b); } ret b; } @@ -291,7 +291,7 @@ fn test_count() { #[test] fn test_foldr() { - fn sub(&&a: int, -b: int) -> int { + fn sub(&&a: int, &&b: int) -> int { a - b } let sum = foldr([1, 2, 3, 4], 0, sub);