Skip to content

Commit 8cdcd60

Browse files
committed
---
yaml --- r: 38369 b: refs/heads/try c: 6644da5 h: refs/heads/master i: 38367: d1fb349 v: v3
1 parent f6bc41b commit 8cdcd60

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
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: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 6a2e495d673932526676ca6980e0ea8da14725dd
5+
refs/heads/try: 6644da5805aa6af93bbe1dcba800d9bdaae56b13
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libcore/vec.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ pub fn partition<T>(v: ~[T], f: fn(&T) -> bool) -> (~[T], ~[T]) {
413413
let mut lefts = ~[];
414414
let mut rights = ~[];
415415

416-
do v.consume |_, elt| {
416+
// FIXME (#4355 maybe): using v.consume here crashes
417+
// do v.consume |_, elt| {
418+
do consume(v) |_, elt| {
417419
if f(&elt) {
418420
lefts.push(elt);
419421
} else {
@@ -855,7 +857,9 @@ pub pure fn filter_map<T, U: Copy>(v: &[T], f: fn(t: &T) -> Option<U>)
855857
*/
856858
pub fn filter<T>(v: ~[T], f: fn(t: &T) -> bool) -> ~[T] {
857859
let mut result = ~[];
858-
do v.consume |_, elem| {
860+
// FIXME (#4355 maybe): using v.consume here crashes
861+
// do v.consume |_, elem| {
862+
do consume(v) |_, elem| {
859863
if f(&elem) { result.push(elem); }
860864
}
861865
result
@@ -3186,10 +3190,11 @@ mod tests {
31863190

31873191
#[test]
31883192
fn test_partition() {
3189-
assert (~[]).partition(|x: &int| *x < 3) == (~[], ~[]);
3190-
assert (~[1, 2, 3]).partition(|x: &int| *x < 4) == (~[1, 2, 3], ~[]);
3191-
assert (~[1, 2, 3]).partition(|x: &int| *x < 2) == (~[1], ~[2, 3]);
3192-
assert (~[1, 2, 3]).partition(|x: &int| *x < 0) == (~[], ~[1, 2, 3]);
3193+
// FIXME (#4355 maybe): using v.partition here crashes
3194+
assert partition(~[], |x: &int| *x < 3) == (~[], ~[]);
3195+
assert partition(~[1, 2, 3], |x: &int| *x < 4) == (~[1, 2, 3], ~[]);
3196+
assert partition(~[1, 2, 3], |x: &int| *x < 2) == (~[1], ~[2, 3]);
3197+
assert partition(~[1, 2, 3], |x: &int| *x < 0) == (~[], ~[1, 2, 3]);
31933198
}
31943199

31953200
#[test]

0 commit comments

Comments
 (0)