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