Skip to content

Add E0035 error explanation #26399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<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!
}
```
"##,

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
Expand Down Expand Up @@ -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
Expand Down