Skip to content

Commit 223cef8

Browse files
committed
---
yaml --- r: 41643 b: refs/heads/master c: 6644da5 h: refs/heads/master i: 41641: cb0b2a1 41639: 413c656 v: v3
1 parent 287bc05 commit 223cef8

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 6a2e495d673932526676ca6980e0ea8da14725dd
2+
refs/heads/master: 6644da5805aa6af93bbe1dcba800d9bdaae56b13
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/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)