1 An implementation cannot be chosen unambiguously because of lack of information.
3 Erroneous code example:
12 impl Generator for Impl {
13 fn create() -> u32 { 1 }
18 impl Generator for AnotherImpl {
19 fn create() -> u32 { 2 }
23 let cont: u32 = Generator::create();
24 // error, impossible to choose one of Generator trait implementation
25 // Should it be Impl or AnotherImpl, maybe something else?
29 This error can be solved by adding type annotations that provide the missing
30 information to the compiler. In this case, the solution is to use a concrete
40 impl Generator for AnotherImpl {
41 fn create() -> u32 { 2 }
45 let gen1 = AnotherImpl::create();
47 // if there are multiple methods with same name (different traits)
48 let gen2 = <AnotherImpl as Generator>::create();