File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
branches/stable/src/librustc_typeck Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: d4c37088ca873a23e58d512d9418f59056477226
32
+ refs/heads/stable: 8c5572fc2114fa2e8156c89cda89c799c9c3e9e0
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
Original file line number Diff line number Diff line change @@ -212,8 +212,8 @@ http://doc.rust-lang.org/reference.html#trait-objects
212
212
"## ,
213
213
214
214
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:
217
217
218
218
```
219
219
struct Test;
@@ -230,7 +230,7 @@ impl Trait1 for Test { fn foo() {} }
230
230
impl Trait2 for Test { fn foo() {} }
231
231
232
232
fn main() {
233
- Test::foo() // error, what foo() to call?
233
+ Test::foo() // error, which foo() to call?
234
234
}
235
235
```
236
236
@@ -250,6 +250,28 @@ fn main() {
250
250
Test::foo() // and now that's good!
251
251
}
252
252
```
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
+ ```
253
275
"## ,
254
276
255
277
E0035 : r##"
You can’t perform that action at this time.
0 commit comments