]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/elided-in-expr-position.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / elided-in-expr-position.rs
1 #![feature(generic_associated_types)]
2 #![allow(unused)]
3
4 pub trait Trait  {
5     type Assoc<'a> where Self: 'a;
6
7     fn f(&self) -> Self::Assoc<'_>;
8
9     // Disallow elision in return position, for now
10     fn g(&self) -> Self::Assoc;
11     //~^ ERROR missing generics for associated type `Trait::Assoc`
12 }
13
14 pub struct Struct {
15     item: f32
16 }
17
18 pub struct GenericStruct<'a> {
19     ref_item: &'a f32
20 }
21
22 impl Trait for Struct {
23     type Assoc<'a> = GenericStruct<'a>;
24
25     fn f(&self) -> Self::Assoc<'_> {
26         Self::Assoc {
27             ref_item: &self.item
28         }
29     }
30
31     // Disallow elision in return position, for now
32     fn g(&self) -> Self::Assoc {
33     //~^ ERROR missing generics for associated type `Trait::Assoc`
34         todo!()
35     }
36 }
37
38 fn main() {}