]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-80433.rs
Rollup merge of #82308 - estebank:issue-82290, r=lcnr
[rust.git] / src / test / ui / generic-associated-types / issue-80433.rs
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>;
11       //~^ ERROR missing generics
12     fn test_mut<'a>(&'a mut self) -> Self::Output<'a>;
13 }
14
15 impl<T> TestMut for E<T>
16 where
17     T: 'static,
18 {
19     type Output<'a> = &'a mut T;
20     fn test_mut<'a>(&'a mut self) -> Self::Output<'a> {
21         &mut self.data
22     }
23 }
24
25 fn test_simpler<'a>(dst: &'a mut impl TestMut<Output = &'a mut f32>)
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 }