Skip to content

Commit 09c4b89

Browse files
committed
---
yaml --- r: 52191 b: refs/heads/dist-snap c: 6644da5 h: refs/heads/master i: 52189: ee14215 52187: 50cc816 52183: 0973a29 52175: 3f5d585 52159: 7977215 v: v3
1 parent ecc58e7 commit 09c4b89

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 6a2e495d673932526676ca6980e0ea8da14725dd
10+
refs/heads/dist-snap: 6644da5805aa6af93bbe1dcba800d9bdaae56b13
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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)