From 2e919b4c5107a584ffcf58e4b39a001275845fec Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 17 Jul 2015 17:21:58 +0200 Subject: [PATCH] Add E0433 error explanation --- src/librustc_resolve/diagnostics.rs | 54 ++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 96bc3576a94..21a95006094 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -272,7 +272,7 @@ pub mod foo { on this topic: http://doc.rust-lang.org/reference.html#use-declarations -"## +"##, E0403: r##" Some type parameters have the same name. Example of erroneous code: @@ -282,7 +282,7 @@ fn foo(s: T, u: T) {} // error: the name `T` is already used for a type // parameter in this type parameter list ``` -Please verify that none of the type params are misspelled, and rename any +Please verify that none of the type parameterss are misspelled, and rename any clashing parameters. Example: ``` @@ -291,8 +291,8 @@ fn foo(s: T, u: Y) {} // ok! "##, E0404: r##" -You tried to implement a non-trait object on an object. Example of erroneous -code: +You tried to implement something which was not a trait on an object. Example of +erroneous code: ``` struct Foo; @@ -301,8 +301,8 @@ fn foo(s: T, u: Y) {} // ok! impl Foo for Bar {} // error: `Foo` is not a trait ``` -Please verify you didn't mispelled the trait's name or used the wrong object. -Example: +Please verify that you didn't misspell the trait's name or otherwise use the +wrong identifier. Example: ``` trait Foo { @@ -317,7 +317,7 @@ impl Foo for Bar { // ok! "##, E0405: r##" -A non-trait was implemented. Example of erroneous code: +An unknown trait was implemented. Example of erroneous code: ``` struct Foo; @@ -346,8 +346,8 @@ impl SomeTrait for Foo { // ok! "##, E0407: r##" -A definition of a method not in the implemented trait was given. Example of -erroneous code: +A definition of a method not in the implemented trait was given in a trait +implementation. Example of erroneous code: ``` trait Foo { @@ -362,8 +362,8 @@ fn b() {} // error: method `b` is not a member of trait `Foo` } ``` -Please verify you didn't mispelled the method name and you used the good -trait. Example: +Please verify you didn't misspell the method name and you used the correct +trait. First example: ``` trait Foo { @@ -378,6 +378,24 @@ fn a() {} fn b() {} // ok! } ``` + +Second example: + +``` +trait Foo { + fn a(); +} + +struct Bar; + +impl Foo for Bar { + fn a() {} +} + +impl Bar { + fn b() {} +} +``` "##, E0428: r##" @@ -389,7 +407,7 @@ fn b() {} // ok! struct Bar; // error: duplicate definition of value `Bar` ``` -Please verify you didn't mispelled the type/module's name or remove the +Please verify you didn't misspell the type/module's name or remove/rename the duplicated one. Example: ``` @@ -398,6 +416,17 @@ fn b() {} // ok! ``` "##, +E0433: r##" +Invalid import. Example of erroneous code: + +``` +use something_which_doesnt_exist; +// error: unresolved import `something_which_doesnt_exist` +``` + +Please verify you didn't misspell the import's name. +"##, + } register_diagnostics! { @@ -438,7 +467,6 @@ fn b() {} // ok! E0431, // `self` import can only appear in an import list with a non-empty // prefix E0432, // unresolved import - E0433, // failed to resolve E0434, // can't capture dynamic environment in a fn item E0435, // attempt to use a non-constant value in a constant E0437, // type is not a member of trait