]> git.lizzy.rs Git - rust.git/commitdiff
Add E0101 error explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 30 Jun 2015 09:19:16 +0000 (11:19 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Tue, 30 Jun 2015 17:21:23 +0000 (19:21 +0200)
src/librustc_typeck/diagnostics.rs

index 49f58d0d9e9de4a993cce1bd0dac3f5d2ae56822..affa0768697dadf51c407fdb27ebb45fedcd508b 100644 (file)
@@ -1023,7 +1023,7 @@ fn main() {
 "##,
 
 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 @@ 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)]
@@ -1049,7 +1049,7 @@ fn main() {
 "##,
 
 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 @@ fn main() {
 }
 ```
 
-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 @@ fn main() {
 ```
 "##,
 
+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 @@ fn foo() {}
 
 ```
 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 @@ impl Baz for Bar { } // Note: This is OK
     E0085,
     E0086,
     E0090,
-    E0101,
     E0102,
     E0103,
     E0104,