]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs/struct-path-self.rs
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / 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 Self
7         let z = Self::<u8> {};
8         //~^ ERROR expected struct, variant or union type, found Self
9         //~| ERROR type arguments are not allowed on this entity
10         match s {
11             Self { .. } => {}
12             //~^ ERROR expected struct, variant or union type, found Self
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 this entity
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 this entity
31         match s {
32             Self { .. } => {} // OK
33         }
34     }
35 }
36
37 fn main() {}