blob: 79d2c8204f95624c1c7f1bd0b8695ef34437d45b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
An implementation cannot be chosen unambiguously because of lack of information.
Erroneous code example:
```compile_fail,E0283
struct Foo;
impl Into<u32> for Foo {
fn into(self) -> u32 { 1 }
}
let foo = Foo;
let bar: u32 = foo.into() * 1u32;
```
This error can be solved by adding type annotations that provide the missing
information to the compiler. In this case, the solution is to specify the
trait's type parameter:
```
struct Foo;
impl Into<u32> for Foo {
fn into(self) -> u32 { 1 }
}
let foo = Foo;
let bar: u32 = Into::<u32>::into(foo) * 1u32;
```
|