Skip to content

Commit fc3d0c9

Browse files
---
yaml --- r: 225977 b: refs/heads/stable c: d4c3708 h: refs/heads/master i: 225975: 86db16b v: v3
1 parent d7278d7 commit fc3d0c9

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
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: b4481e68deeffc9e6cf4648d10c51750adbb4c3b
32+
refs/heads/stable: d4c37088ca873a23e58d512d9418f59056477226
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

branches/stable/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)