diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-07-17 14:14:41 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-07-21 19:28:58 +0200 |
| commit | cd385cbe34d8a9bad2a6d03c1ef50dd04642a379 (patch) | |
| tree | f77099dc1342d22602263a2443f2c71d12c42bd6 /src | |
| parent | 0eb7303c7062792049c0ec4ff2c42565db6d60ff (diff) | |
| download | rust-cd385cbe34d8a9bad2a6d03c1ef50dd04642a379.tar.gz rust-cd385cbe34d8a9bad2a6d03c1ef50dd04642a379.zip | |
Add E0405 error explanation
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_resolve/diagnostics.rs | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 2a5a31dcd19..428e084064e 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -282,10 +282,41 @@ fn foo<T, T>(s: T, u: T) {} // error: the name `T` is already used for a type // parameter in this type parameter list ``` -Please verify you didn't mispell the type parameters. Example: +Please verify that none of the type params are misspelled, and rename any +clashing parameters. Example: ``` -fn foo<T, Y>(s: T, u: Y) {} +fn foo<T, Y>(s: T, u: Y) {} // ok! +``` +"##, + +E0405: r##" +You tried to implement an undefined trait on an object. Example of +erroneous code: + +``` +struct Foo; + +impl SomeTrait for Foo {} // error: use of undeclared trait name `SomeTrait` +``` + +Please verify that the name of the trait wasn't misspelled and ensure that it +was imported. Example: + +``` +// solution 1: +use some_file::SomeTrait; + +// solution 2: +trait SomeTrait { + // some functions +} + +struct Foo; + +impl SomeTrait for Foo { // ok! + // implements functions +} ``` "## @@ -300,7 +331,6 @@ register_diagnostics! { E0401, // can't use type parameters from outer function E0402, // cannot use an outer type parameter in this context E0404, // is not a trait - E0405, // use of undeclared trait name E0406, // undeclared associated type E0407, // method is not a member of trait E0408, // variable from pattern #1 is not bound in pattern # |
