From b12bb126f6895ca99f29aeee7ab5061f00e47747 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 18 Jun 2015 16:27:43 +0200 Subject: [PATCH 1/2] Add E0035 error explanation --- src/librustc_typeck/diagnostics.rs | 35 +++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index d89174295a892..804f8296993c2 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -211,6 +211,40 @@ Reference: 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::(); // 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! +} +``` +"##, + E0040: r##" It is not allowed to manually call destructors in Rust. It is also not necessary to do this since `drop` is called automatically whenever a value goes @@ -1321,7 +1355,6 @@ For more information see the [opt-in builtin traits RFC](https://github.com/rust register_diagnostics! { E0034, // multiple applicable methods in scope - E0035, // does not take type parameters E0036, // incorrect number of type parameters given for this method E0044, // foreign items may not have type parameters E0045, // variadic function must have C calling convention From 742f4bc079d3491f0137ad2eb0ae9da7e48ffa10 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 18 Jun 2015 16:35:46 +0200 Subject: [PATCH 2/2] Remove unneeded indentation --- src/librustc_typeck/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 804f8296993c2..a62f1a863055c 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -223,7 +223,7 @@ impl Test { fn main() { let x = Test; - + x.method::(); // Error: Test::method doesn't need type parameter! } ``` @@ -239,7 +239,7 @@ impl Test { fn main() { let x = Test; - + x.method(); // OK, we're good! } ```