]> git.lizzy.rs Git - rust.git/commitdiff
Add E0035 error explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 19 Jun 2015 11:58:15 +0000 (13:58 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 19 Jun 2015 11:58:15 +0000 (13:58 +0200)
src/librustc_typeck/diagnostics.rs

index a9fe1a1f82b9f8f463049039fde1e8f102cc2d02..c95dbd3ca13b9a34b9c1fd83b42af47b13e9309f 100644 (file)
@@ -211,6 +211,40 @@ struct Dog {
 http://doc.rust-lang.org/reference.html#trait-objects
 "##,
 
+E0035: r##"
+You tried to give a type parameter where it wasn't needed. Bad example:
+
+```
+struct Test;
+
+impl Test {
+    fn method(&self) {}
+}
+
+fn main() {
+    let x = Test;
+    
+    x.method::<i32>(); // Error: Test::method doesn't need type parameter!
+}
+```
+
+To fix this error, just remove the type parameter:
+
+```
+struct Test;
+
+impl Test {
+    fn method(&self) {}
+}
+
+fn main() {
+    let x = Test;
+    
+    x.method(); // OK, we're good!
+}
+```
+"##,
+
 E0036: r##"
 This error occurrs when you pass too many or not enough type parameters to
 a method. Example: