Skip to content

Commit d69a2d8

Browse files
---
yaml --- r: 227639 b: refs/heads/try c: d4c3708 h: refs/heads/master i: 227637: 0562067 227635: 6a60736 227631: c3002bb v: v3
1 parent 6675cbb commit d69a2d8

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: b4481e68deeffc9e6cf4648d10c51750adbb4c3b
4+
refs/heads/try: d4c37088ca873a23e58d512d9418f59056477226
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_typeck/diagnostics.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,47 @@ Reference:
211211
http://doc.rust-lang.org/reference.html#trait-objects
212212
"##,
213213

214+
E0034: r##"
215+
The compiler doesn't know what method to call because more than one does
216+
have the same prototype. Example:
217+
218+
```
219+
struct Test;
220+
221+
trait Trait1 {
222+
fn foo();
223+
}
224+
225+
trait Trait2 {
226+
fn foo();
227+
}
228+
229+
impl Trait1 for Test { fn foo() {} }
230+
impl Trait2 for Test { fn foo() {} }
231+
232+
fn main() {
233+
Test::foo() // error, what foo() to call?
234+
}
235+
```
236+
237+
To avoid this error, you have to keep only one of them and remove the others.
238+
So let's take our example and fix it:
239+
240+
```
241+
struct Test;
242+
243+
trait Trait1 {
244+
fn foo();
245+
}
246+
247+
impl Trait1 for Test { fn foo() {} }
248+
249+
fn main() {
250+
Test::foo() // and now that's good!
251+
}
252+
```
253+
"##,
254+
214255
E0035: r##"
215256
You tried to give a type parameter where it wasn't needed. Bad example:
216257

0 commit comments

Comments
 (0)