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