]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/overloaded-index-assoc-list.rs
fix rpass/cfail tests
[rust.git] / src / test / run-pass / overloaded-index-assoc-list.rs
index 0347f8a29df28b3e739f2917b39c592b7ceea16a..77bb981cfd9b9a3f0fe06d389a9402c4cd4a1197 100644 (file)
@@ -11,6 +11,8 @@
 // Test overloading of the `[]` operator.  In particular test that it
 // takes its argument *by reference*.
 
+#![feature(associated_types)]
+
 use std::ops::Index;
 
 struct AssociationList<K,V> {
@@ -28,7 +30,9 @@ fn push(&mut self, key: K, value: V) {
     }
 }
 
-impl<K: PartialEq + std::fmt::Show, V:Clone> Index<K,V> for AssociationList<K,V> {
+impl<K: PartialEq + std::fmt::Show, V:Clone> Index<K> for AssociationList<K,V> {
+    type Output = V;
+
     fn index<'a>(&'a self, index: &K) -> &'a V {
         for pair in self.pairs.iter() {
             if pair.key == *index {