]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generic-associated-types/issue-80433.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / generic-associated-types / issue-80433.rs
CommitLineData
5869c6ff
XL
1#![feature(generic_associated_types)]
2#![allow(incomplete_features)]
3
4#[derive(Default)]
5struct E<T> {
6 data: T,
7}
8
9trait TestMut {
10 type Output<'a>;
5869c6ff
XL
11 fn test_mut<'a>(&'a mut self) -> Self::Output<'a>;
12}
13
14impl<T> TestMut for E<T>
15where
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
24fn 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
32fn main() {
33 let mut t1: E<f32> = Default::default();
34 test_simpler(&mut t1);
35}