]> git.lizzy.rs Git - rust.git/blob - tests/ui/structs/struct-path-self.rs
internally change regions to be covariant
[rust.git] / tests / ui / structs / struct-path-self.rs
1 struct S;
2
3 trait Tr {
4     fn f() {
5         let s = Self {};
6         //~^ ERROR expected struct, variant or union type, found type parameter
7         let z = Self::<u8> {};
8         //~^ ERROR expected struct, variant or union type, found type parameter
9         //~| ERROR type arguments are not allowed on self type
10         match s {
11             Self { .. } => {}
12             //~^ ERROR expected struct, variant or union type, found type parameter
13         }
14     }
15 }
16
17 impl Tr for S {
18     fn f() {
19         let s = Self {}; // OK
20         let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on self type
21         match s {
22             Self { .. } => {} // OK
23         }
24     }
25 }
26
27 impl S {
28     fn g() {
29         let s = Self {}; // OK
30         let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on self type
31         match s {
32             Self { .. } => {} // OK
33         }
34     }
35 }
36
37 fn main() {}