]> git.proxmox.com Git - rustc.git/blame - src/test/ui/structs/struct-path-self.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / structs / struct-path-self.rs
CommitLineData
c30ab7b3
SL
1struct S;
2
3trait Tr {
4 fn f() {
5 let s = Self {};
e1599b0c 6 //~^ ERROR expected struct, variant or union type, found type parameter
c30ab7b3 7 let z = Self::<u8> {};
e1599b0c 8 //~^ ERROR expected struct, variant or union type, found type parameter
923072b8 9 //~| ERROR type arguments are not allowed on self type
c30ab7b3
SL
10 match s {
11 Self { .. } => {}
e1599b0c 12 //~^ ERROR expected struct, variant or union type, found type parameter
c30ab7b3
SL
13 }
14 }
15}
16
17impl Tr for S {
18 fn f() {
19 let s = Self {}; // OK
923072b8 20 let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on self type
c30ab7b3
SL
21 match s {
22 Self { .. } => {} // OK
23 }
24 }
25}
26
27impl S {
28 fn g() {
29 let s = Self {}; // OK
923072b8 30 let z = Self::<u8> {}; //~ ERROR type arguments are not allowed on self type
c30ab7b3
SL
31 match s {
32 Self { .. } => {} // OK
33 }
34 }
35}
36
37fn main() {}