1 use std::ops::{Index, IndexMut};
8 impl<'a> Index<&'a String> for Foo {
11 fn index(&self, z: &String) -> &isize {
20 impl<'a> IndexMut<&'a String> for Foo {
21 fn index_mut(&mut self, z: &String) -> &mut isize {
34 impl Index<isize> for Bar {
37 fn index<'a>(&'a self, z: isize) -> &'a isize {
47 let mut s = "hello".to_string();
49 println!("{}", f[&s]);
50 //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
52 //~^ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
57 //~^ ERROR cannot assign to data in an index of `Bar`