about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorblake2-ppc <blake2-ppc>2013-08-30 20:00:26 +0200
committerblake2-ppc <blake2-ppc>2013-08-30 20:06:26 +0200
commit43ef5ad18410da5f50efc78fbb781f4e1037b02a (patch)
tree57954047d6f5b443b32cca5835e4e13a27dac3e4 /src/libstd
parent46a6dbc5418ce7858eeafd2b0e252d7b66049519 (diff)
downloadrust-43ef5ad18410da5f50efc78fbb781f4e1037b02a.tar.gz
rust-43ef5ad18410da5f50efc78fbb781f4e1037b02a.zip
std::select: Use correct indices from the front
Caught a bug where .enumerate() was used on a reverse iterator. The
indices should be counted from the front here (bblum confirms).
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/select.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/select.rs b/src/libstd/select.rs
index d0afeb4be85..9f4fd8db788 100644
--- a/src/libstd/select.rs
+++ b/src/libstd/select.rs
@@ -11,7 +11,7 @@
 use cell::Cell;
 use comm;
 use container::Container;
-use iterator::Iterator;
+use iterator::{Iterator, DoubleEndedIterator};
 use option::*;
 // use either::{Either, Left, Right};
 // use rt::kill::BlockedTask;
@@ -87,7 +87,7 @@ pub fn select<A: Select>(ports: &mut [A]) -> uint {
     // Task resumes. Now unblock ourselves from all the ports we blocked on.
     // If the success index wasn't reset, 'take' will just take all of them.
     // Iterate in reverse so the 'earliest' index that's ready gets returned.
-    for (index, port) in ports.mut_slice(0, ready_index).mut_rev_iter().enumerate() {
+    for (index, port) in ports.mut_slice(0, ready_index).mut_iter().enumerate().invert() {
         if port.unblock_from() {
             ready_index = index;
         }