about summary refs log tree commit diff
path: root/src/libsync
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-23 08:42:21 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-30 08:54:30 -0700
commit1d356624a1c03363be37886ffdad7dcf25ee81f6 (patch)
tree4aef71be9e3f509b1bc8b4880e6894656e6404c4 /src/libsync
parent18a3db6aa1ce9e66b0c9cb776588d56470c6078b (diff)
downloadrust-1d356624a1c03363be37886ffdad7dcf25ee81f6.tar.gz
rust-1d356624a1c03363be37886ffdad7dcf25ee81f6.zip
collections: Enable IndexMut for some collections
This commit enables implementations of IndexMut for a number of collections,
including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same
time this deprecates the `get_mut` methods on vectors in favor of using the
indexing notation.

cc #18424
Diffstat (limited to 'src/libsync')
-rw-r--r--src/libsync/comm/sync.rs4
-rw-r--r--src/libsync/raw.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs
index bbb4813f5f9..42de6f66289 100644
--- a/src/libsync/comm/sync.rs
+++ b/src/libsync/comm/sync.rs
@@ -426,7 +426,7 @@ impl<T> Buffer<T> {
     fn enqueue(&mut self, t: T) {
         let pos = (self.start + self.size) % self.buf.len();
         self.size += 1;
-        let prev = mem::replace(self.buf.get_mut(pos), Some(t));
+        let prev = mem::replace(&mut self.buf[pos], Some(t));
         assert!(prev.is_none());
     }
 
@@ -434,7 +434,7 @@ impl<T> Buffer<T> {
         let start = self.start;
         self.size -= 1;
         self.start = (self.start + 1) % self.buf.len();
-        self.buf.get_mut(start).take().unwrap()
+        self.buf[start].take().unwrap()
     }
 
     fn size(&self) -> uint { self.size }
diff --git a/src/libsync/raw.rs b/src/libsync/raw.rs
index 4fd62ac3a1d..1410091b924 100644
--- a/src/libsync/raw.rs
+++ b/src/libsync/raw.rs
@@ -308,7 +308,7 @@ impl<'a> Condvar<'a> {
                     // To avoid :broadcast_heavy, we make a new waitqueue,
                     // swap it out with the old one, and broadcast on the
                     // old one outside of the little-lock.
-                    queue = Some(mem::replace(state.blocked.get_mut(condvar_id),
+                    queue = Some(mem::replace(&mut state.blocked[condvar_id],
                                               WaitQueue::new()));
                 } else {
                     out_of_bounds = Some(state.blocked.len());