1 struct S;
2 
3 trait Tr {
f()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 for this 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 {
f()18     fn f() {
19         let s = Self {}; // OK
20         let z = Self::<u8> {}; //~ ERROR type arguments are not allowed for this type
21         match s {
22             Self { .. } => {} // OK
23         }
24     }
25 }
26 
27 impl S {
g()28     fn g() {
29         let s = Self {}; // OK
30         let z = Self::<u8> {}; //~ ERROR type arguments are not allowed for this type
31         match s {
32             Self { .. } => {} // OK
33         }
34     }
35 }
36 
main()37 fn main() {}
38