1 struct S;
2
3 trait Tr {
4 type A;
5 }
6
7 impl Tr for S {
8 type A = S;
9 }
10
f<T: Tr>()11 fn f<T: Tr>() {
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
16 //~| ERROR type arguments are not allowed for this type
17 match S {
18 T::A {} => {}
19 //~^ ERROR expected struct, variant or union type, found associated type
20 }
21 }
22
g<T: Tr<A = S>>()23 fn g<T: Tr<A = S>>() {
24 let s = T::A {}; // OK
25 let z = T::A::<u8> {}; //~ ERROR type arguments are not allowed for this type
26 match S {
27 T::A {} => {} // OK
28 }
29 }
30
main()31 fn main() {
32 let s = S::A {}; //~ ERROR ambiguous associated type
33 let z = S::A::<u8> {}; //~ ERROR ambiguous associated type
34 match S {
35 S::A {} => {} //~ ERROR ambiguous associated type
36 }
37 }
38