// 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> {
}
}
-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 {