File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,47 @@ Reference:
211
211
http://doc.rust-lang.org/reference.html#trait-objects
212
212
"## ,
213
213
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
+
214
255
E0035 : r##"
215
256
You tried to give a type parameter where it wasn't needed. Bad example:
216
257
You can’t perform that action at this time.
0 commit comments