]> git.proxmox.com Git - rustc.git/blame - src/test/ui/generic-associated-types/issue-76535.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / ui / generic-associated-types / issue-76535.rs
CommitLineData
5869c6ff 1#![feature(generic_associated_types)]
6a06907d 2//~^ WARNING the feature
5869c6ff
XL
3
4pub trait SubTrait {}
5
6pub trait SuperTrait {
7 type SubType<'a>: SubTrait;
6a06907d 8 //~^ ERROR missing generics for associated
5869c6ff
XL
9
10 fn get_sub<'a>(&'a mut self) -> Self::SubType<'a>;
11}
12
13pub struct SubStruct<'a> {
14 sup: &'a mut SuperStruct,
15}
16
17impl<'a> SubTrait for SubStruct<'a> {}
18
19pub struct SuperStruct {
20 value: u8,
21}
22
23impl SuperStruct {
24 pub fn new(value: u8) -> SuperStruct {
25 SuperStruct { value }
26 }
27}
28
29impl SuperTrait for SuperStruct {
30 type SubType<'a> = SubStruct<'a>;
31
32 fn get_sub<'a>(&'a mut self) -> Self::SubType<'a> {
33 SubStruct { sup: self }
34 }
35}
36
37fn main() {
38 let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
5869c6ff 39}