Skip to content

Commit 47a10d2

Browse files
---
yaml --- r: 227640 b: refs/heads/try c: 8c5572f h: refs/heads/master v: v3
1 parent d69a2d8 commit 47a10d2

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
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: d4c37088ca873a23e58d512d9418f59056477226
4+
refs/heads/try: 8c5572fc2114fa2e8156c89cda89c799c9c3e9e0
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: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ http://doc.rust-lang.org/reference.html#trait-objects
212212
"##,
213213

214214
E0034: r##"
215-
The compiler doesn't know what method to call because more than one does
216-
have the same prototype. Example:
215+
The compiler doesn't know what method to call because more than one method
216+
has the same prototype. Example:
217217
218218
```
219219
struct Test;
@@ -230,7 +230,7 @@ impl Trait1 for Test { fn foo() {} }
230230
impl Trait2 for Test { fn foo() {} }
231231
232232
fn main() {
233-
Test::foo() // error, what foo() to call?
233+
Test::foo() // error, which foo() to call?
234234
}
235235
```
236236
@@ -250,6 +250,28 @@ fn main() {
250250
Test::foo() // and now that's good!
251251
}
252252
```
253+
254+
However, a better solution would be using fully explicit naming of type and
255+
trait:
256+
257+
```
258+
struct Test;
259+
260+
trait Trait1 {
261+
fn foo();
262+
}
263+
264+
trait Trait2 {
265+
fn foo();
266+
}
267+
268+
impl Trait1 for Test { fn foo() {} }
269+
impl Trait2 for Test { fn foo() {} }
270+
271+
fn main() {
272+
<Test as Trait1>::foo()
273+
}
274+
```
253275
"##,
254276

255277
E0035: r##"

0 commit comments

Comments
 (0)