about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-21 22:15:42 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-04-23 10:03:43 -0700
commitf4083a22451692b9ae360f3d12bfb8cb52b096e4 (patch)
tree5def1ac72e0ed4208f3995fdf609e8ac8539c65f /src/libcollections
parent159a10da4c15e5d34e00d4018b352573cec7918f (diff)
downloadrust-f4083a22451692b9ae360f3d12bfb8cb52b096e4.tar.gz
rust-f4083a22451692b9ae360f3d12bfb8cb52b096e4.zip
std: Change RandomAccessIterator to use `&mut self`
Many iterators go through a closure when dealing with the `idx` method, which
are invalid after the previous change (closures cannot be invoked through a `&`
pointer). This commit alters the `fn idx` method on the RandomAccessIterator
to take `&mut self` rather than `&self`.

[breaking-change]
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/bitv.rs2
-rw-r--r--src/libcollections/ringbuf.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index 6326f83b497..13180cdfa5b 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -632,7 +632,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
     }
 
     #[inline]
-    fn idx(&self, index: uint) -> Option<bool> {
+    fn idx(&mut self, index: uint) -> Option<bool> {
         if index >= self.indexable() {
             None
         } else {
diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs
index 19dc2d2ae58..9204a9ca400 100644
--- a/src/libcollections/ringbuf.rs
+++ b/src/libcollections/ringbuf.rs
@@ -272,7 +272,7 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
     fn indexable(&self) -> uint { self.rindex - self.index }
 
     #[inline]
-    fn idx(&self, j: uint) -> Option<&'a T> {
+    fn idx(&mut self, j: uint) -> Option<&'a T> {
         if j >= self.indexable() {
             None
         } else {