]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-80433.rs
Rollup merge of #102954 - GuillaumeGomez:cfg-hide-attr-checks, r=Manishearth
[rust.git] / src / test / ui / generic-associated-types / issue-80433.rs
1 #[derive(Default)]
2 struct E<T> {
3     data: T,
4 }
5
6 trait TestMut {
7     type Output<'a>;
8     fn test_mut<'a>(&'a mut self) -> Self::Output<'a>;
9 }
10
11 impl<T> TestMut for E<T>
12 where
13     T: 'static,
14 {
15     type Output<'a> = &'a mut T;
16     fn test_mut<'a>(&'a mut self) -> Self::Output<'a> {
17         &mut self.data
18     }
19 }
20
21 fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
22   //~^ ERROR missing generics for associated type
23 {
24     for n in 0i16..100 {
25         *dst.test_mut() = n.into();
26     }
27 }
28
29 fn main() {
30     let mut t1: E<f32> = Default::default();
31     test_simpler(&mut t1);
32 }