Skip to content

Commit ff58b7b

Browse files
committed
---
yaml --- r: 11959 b: refs/heads/master c: b1eb457 h: refs/heads/master i: 11957: 5d5c793 11955: 6f4717c 11951: 600ec4f v: v3
1 parent 5733a13 commit ff58b7b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
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: d6ded6788dbf24a6545f579a23a92553efae1c2e
2+
refs/heads/master: b1eb4579c695871f75c995b7792ec5f100fbabf9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/vec.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,19 @@ fn iter_between<T>(v: [const T], start: uint, end: uint, f: fn(T)) {
773773
}
774774
}
775775

776-
#[doc = "Iterates over two vectors in parallel"]
776+
#[doc = "
777+
Iterates over two vectors simultaneously
778+
779+
# Failure
780+
781+
Both vectors must have the same length
782+
"]
777783
#[inline]
778-
fn iter2<U, T>(v: [ U], v2: [const T], f: fn(U, T)) {
779-
let mut i = 0;
780-
for elt in v { f(elt, v2[i]); i += 1; }
784+
fn iter2<U, T>(v1: [const U], v2: [const T], f: fn(U, T)) {
785+
assert len(v1) == len(v2);
786+
uint::range(0u, len(v1)) {|i|
787+
f(v1[i], v2[i])
788+
}
781789
}
782790

783791
#[doc = "

0 commit comments

Comments
 (0)