1 An attempt was made to retrieve an associated type, but the type was ambiguous.
3 Erroneous code example:
6 trait MyTrait {type X; }
13 The problem here is that we're attempting to take the type of X from MyTrait.
14 Unfortunately, the type of X is not defined, because it's only made concrete in
15 implementations of the trait. A working version of this code might look like:
18 trait MyTrait {type X; }
21 impl MyTrait for MyStruct {
26 let foo: <MyStruct as MyTrait>::X;
30 This syntax specifies that we want the X type from MyTrait, as made concrete in
31 MyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct
32 might implement two different traits with identically-named associated types.
33 This syntax allows disambiguation between the two.