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