1 // Test that overloaded index expressions with DST result types
2 // can't be used as rvalues
10 impl Index<usize> for S {
13 fn index(&self, _: usize) -> &str {
18 #[derive(Copy, Clone)]
21 impl Index<usize> for T {
22 type Output = dyn Debug + 'static;
24 fn index<'a>(&'a self, idx: usize) -> &'a (dyn Debug + 'static) {
32 //~^ ERROR cannot move out of index of `S`
35 //~^ ERROR cannot move out of index of `T`