1 #![feature(generic_associated_types)] 2 3 #[derive(Default)] 4 struct E<T> { 5 data: T, 6 } 7 8 trait TestMut { 9 type Output<'a>; test_mut<'a>(&'a mut self) -> Self::Output<'a>10 fn test_mut<'a>(&'a mut self) -> Self::Output<'a>; 11 } 12 13 impl<T> TestMut for E<T> 14 where 15 T: 'static, 16 { 17 type Output<'a> = &'a mut T; test_mut<'a>(&'a mut self) -> Self::Output<'a>18 fn test_mut<'a>(&'a mut self) -> Self::Output<'a> { 19 &mut self.data 20 } 21 } 22 test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)23fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>) 24 //~^ ERROR missing generics for associated type 25 { 26 for n in 0i16..100 { 27 *dst.test_mut() = n.into(); 28 } 29 } 30 main()31fn main() { 32 let mut t1: E<f32> = Default::default(); 33 test_simpler(&mut t1); 34 } 35