@@ -106,8 +106,7 @@ mod foo {
106106use foo::MyTrait::do_something;
107107```
108108
109- In general, it's not legal to directly import methods belonging to a
110- trait or concrete type.
109+ It's illegal to directly import methods belonging to a trait or concrete type.
111110"## ,
112111
113112E0255 : r##"
@@ -272,7 +271,160 @@ See the 'Use Declarations' section of the reference for more information
272271on this topic:
273272
274273http://doc.rust-lang.org/reference.html#use-declarations
275- "##
274+ "## ,
275+
276+ E0403 : r##"
277+ Some type parameters have the same name. Example of erroneous code:
278+
279+ ```
280+ fn foo<T, T>(s: T, u: T) {} // error: the name `T` is already used for a type
281+ // parameter in this type parameter list
282+ ```
283+
284+ Please verify that none of the type parameterss are misspelled, and rename any
285+ clashing parameters. Example:
286+
287+ ```
288+ fn foo<T, Y>(s: T, u: Y) {} // ok!
289+ ```
290+ "## ,
291+
292+ E0404 : r##"
293+ You tried to implement something which was not a trait on an object. Example of
294+ erroneous code:
295+
296+ ```
297+ struct Foo;
298+ struct Bar;
299+
300+ impl Foo for Bar {} // error: `Foo` is not a trait
301+ ```
302+
303+ Please verify that you didn't misspell the trait's name or otherwise use the
304+ wrong identifier. Example:
305+
306+ ```
307+ trait Foo {
308+ // some functions
309+ }
310+ struct Bar;
311+
312+ impl Foo for Bar { // ok!
313+ // functions implementation
314+ }
315+ ```
316+ "## ,
317+
318+ E0405 : r##"
319+ An unknown trait was implemented. Example of erroneous code:
320+
321+ ```
322+ struct Foo;
323+
324+ impl SomeTrait for Foo {} // error: use of undeclared trait name `SomeTrait`
325+ ```
326+
327+ Please verify that the name of the trait wasn't misspelled and ensure that it
328+ was imported. Example:
329+
330+ ```
331+ // solution 1:
332+ use some_file::SomeTrait;
333+
334+ // solution 2:
335+ trait SomeTrait {
336+ // some functions
337+ }
338+
339+ struct Foo;
340+
341+ impl SomeTrait for Foo { // ok!
342+ // implements functions
343+ }
344+ ```
345+ "## ,
346+
347+ E0407 : r##"
348+ A definition of a method not in the implemented trait was given in a trait
349+ implementation. Example of erroneous code:
350+
351+ ```
352+ trait Foo {
353+ fn a();
354+ }
355+
356+ struct Bar;
357+
358+ impl Foo for Bar {
359+ fn a() {}
360+ fn b() {} // error: method `b` is not a member of trait `Foo`
361+ }
362+ ```
363+
364+ Please verify you didn't misspell the method name and you used the correct
365+ trait. First example:
366+
367+ ```
368+ trait Foo {
369+ fn a();
370+ fn b();
371+ }
372+
373+ struct Bar;
374+
375+ impl Foo for Bar {
376+ fn a() {}
377+ fn b() {} // ok!
378+ }
379+ ```
380+
381+ Second example:
382+
383+ ```
384+ trait Foo {
385+ fn a();
386+ }
387+
388+ struct Bar;
389+
390+ impl Foo for Bar {
391+ fn a() {}
392+ }
393+
394+ impl Bar {
395+ fn b() {}
396+ }
397+ ```
398+ "## ,
399+
400+ E0428 : r##"
401+ A type or module has been defined more than once. Example of erroneous
402+ code:
403+
404+ ```
405+ struct Bar;
406+ struct Bar; // error: duplicate definition of value `Bar`
407+ ```
408+
409+ Please verify you didn't misspell the type/module's name or remove/rename the
410+ duplicated one. Example:
411+
412+ ```
413+ struct Bar;
414+ struct Bar2; // ok!
415+ ```
416+ "## ,
417+
418+ E0433 : r##"
419+ Invalid import. Example of erroneous code:
420+
421+ ```
422+ use something_which_doesnt_exist;
423+ // error: unresolved import `something_which_doesnt_exist`
424+ ```
425+
426+ Please verify you didn't misspell the import's name.
427+ "## ,
276428
277429}
278430
@@ -284,11 +436,7 @@ register_diagnostics! {
284436 E0258 ,
285437 E0401 , // can't use type parameters from outer function
286438 E0402 , // cannot use an outer type parameter in this context
287- E0403 , // the name `{}` is already used
288- E0404 , // is not a trait
289- E0405 , // use of undeclared trait name
290439 E0406 , // undeclared associated type
291- E0407 , // method is not a member of trait
292440 E0408 , // variable from pattern #1 is not bound in pattern #
293441 E0409 , // variable is bound with different mode in pattern # than in
294442 // pattern #1
@@ -313,13 +461,11 @@ register_diagnostics! {
313461 E0425 , // unresolved name
314462 E0426 , // use of undeclared label
315463 E0427 , // cannot use `ref` binding mode with ...
316- E0428 , // duplicate definition of ...
317464 E0429 , // `self` imports are only allowed within a { } list
318465 E0430 , // `self` import can only appear once in the list
319466 E0431 , // `self` import can only appear in an import list with a non-empty
320467 // prefix
321468 E0432 , // unresolved import
322- E0433 , // failed to resolve
323469 E0434 , // can't capture dynamic environment in a fn item
324470 E0435 , // attempt to use a non-constant value in a constant
325471 E0437 , // type is not a member of trait
0 commit comments