diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-06-30 11:19:16 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-06-30 19:21:23 +0200 |
| commit | edf6132be88fa2a51176f84d5fbee45046880717 (patch) | |
| tree | e41409b6dd686b066f0bf9751fcb0ffbf640384e | |
| parent | 758ea34146f4651cb78e2167de3c335007a8f26d (diff) | |
| download | rust-edf6132be88fa2a51176f84d5fbee45046880717.tar.gz rust-edf6132be88fa2a51176f84d5fbee45046880717.zip | |
Add E0101 error explanation
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 49f58d0d9e9..affa0768697 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1023,7 +1023,7 @@ type Foo<A> = Box<A>; // ok! "##, E0092: r##" -You tried to call an undefined atomic operation function. +You tried to declare an undefined atomic operation function. Erroneous code example: ``` @@ -1037,7 +1037,7 @@ extern "rust-intrinsic" { Please check you didn't make a mistake in the function's name. All intrinsic functions are defined in librustc_trans/trans/intrinsic.rs and in -libcore/intrinsics.rs. Example: +libcore/intrinsics.rs in the Rust source code. Example: ``` #![feature(intrinsics)] @@ -1049,7 +1049,7 @@ extern "rust-intrinsic" { "##, E0093: r##" -You called an unknown intrinsic function. Erroneous code example: +You declared an unknown intrinsic function. Erroneous code example: ``` #![feature(intrinsics)] @@ -1067,7 +1067,7 @@ fn main() { Please check you didn't make a mistake in the function's name. All intrinsic functions are defined in librustc_trans/trans/intrinsic.rs and in -libcore/intrinsics.rs. Example: +libcore/intrinsics.rs in the Rust source code. Example: ``` #![feature(intrinsics)] @@ -1097,8 +1097,9 @@ extern "rust-intrinsic" { } ``` -Please check you give the right number of lifetime parameters and/or the -function definition. Example: +Please check that you provided the right number of lifetime parameters +and verify with the function declaration in the Rust source code. +Example: ``` #![feature(intrinsics)] @@ -1109,6 +1110,32 @@ extern "rust-intrinsic" { ``` "##, +E0101: r##" +You hit this error because the compiler the compiler lacks information +to determine a type for this expression. Erroneous code example: + +``` +fn main() { + let x = |_| {}; // error: cannot determine a type for this expression +} +``` + +You have two possibilities to solve this situation: + * Give an explicit definition of the expression + * Infer the expression + +Examples: + +``` +fn main() { + let x = |_ : u32| {}; // ok! + // or: + let x = |_| {}; + x(0u32); +} +``` +"##, + E0106: r##" This error indicates that a lifetime is missing from a type. If it is an error inside a function signature, the problem may be with failing to adhere to the @@ -1343,21 +1370,20 @@ Erroneous code example: ``` trait Trait { - fn t<'a,'b:'a>(x: &'a str, y: &'b str); + fn bar<'a,'b:'a>(x: &'a str, y: &'b str); } struct Foo; impl Trait for Foo { - fn t<'a,'b>(x: &'a str, y: &'b str) { // error: lifetime parameters - // or bounds on method `t` - // do not match the trait - // declaration + fn bar<'a,'b>(x: &'a str, y: &'b str) { + // error: lifetime parameters or bounds on method `bar` + // do not match the trait declaration } } ``` -The 'b lifetime constraints for `t` implementation does not match the +The `'b` lifetime constraint for bar() implementation does not match the trait declaration. Ensure lifetime declarations match exactly in both trait declaration and implementation. Example: @@ -1797,7 +1823,6 @@ register_diagnostics! { E0085, E0086, E0090, - E0101, E0102, E0103, E0104, |
