about summary refs log tree commit diff
path: root/src/libcollections/vec_map.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcollections/vec_map.rs')
-rw-r--r--src/libcollections/vec_map.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs
index bf0c8f10e5f..91edbc7b54e 100644
--- a/src/libcollections/vec_map.rs
+++ b/src/libcollections/vec_map.rs
@@ -562,6 +562,8 @@ impl<V> Extend<(uint, V)> for VecMap<V> {
     }
 }
 
+// NOTE(stage0): remove impl after a snapshot
+#[cfg(stage0)]
 #[stable]
 impl<V> Index<uint, V> for VecMap<V> {
     #[inline]
@@ -570,6 +572,18 @@ impl<V> Index<uint, V> for VecMap<V> {
     }
 }
 
+#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+impl<V> Index<uint> for VecMap<V> {
+    type Output = V;
+
+    #[inline]
+    fn index<'a>(&'a self, i: &uint) -> &'a V {
+        self.get(i).expect("key not present")
+    }
+}
+
+// NOTE(stage0): remove impl after a snapshot
+#[cfg(stage0)]
 #[stable]
 impl<V> IndexMut<uint, V> for VecMap<V> {
     #[inline]
@@ -578,6 +592,17 @@ impl<V> IndexMut<uint, V> for VecMap<V> {
     }
 }
 
+#[cfg(not(stage0))]  // NOTE(stage0): remove cfg after a snapshot
+#[stable]
+impl<V> IndexMut<uint> for VecMap<V> {
+    type Output = V;
+
+    #[inline]
+    fn index_mut<'a>(&'a mut self, i: &uint) -> &'a mut V {
+        self.get_mut(i).expect("key not present")
+    }
+}
+
 macro_rules! iterator {
     (impl $name:ident -> $elem:ty, $($getter:ident),+) => {
         #[stable]