Closed
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=d2a32fe1f3460b6583534eb53d045165
fn foo() {
let _ = "foo".into::<Option<_>>();
}
The current output is:
Compiling playground v0.0.1 (/playground)
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
--> src/lib.rs:2:19
|
2 | let _ = "foo".into::<Option<_>>();
| ^^^^------------- help: remove these generics
| |
| expected 0 generic arguments
|
note: associated function defined here, with 0 generic parameters
For more information about this error, try `rustc --explain E0107`.
error: could not compile `playground` due to previous error
Ideally the output should look like:
error[E0107]: this associated function takes 0 generic arguments but 1 generic argument was supplied
--> src/lib.rs:2:19
|
2 | let _ = "foo".into::<Option<_>>();
| ^^^^------------- help: remove these generics
| |
| expected 0 generic arguments
|
note: associated function defined here, with 0 generic parameters
help: `Into` trait takes 1 generic argument, try annotating that instead: `Into::<Option<_>>::into("foo")
When a user called into()
with an annotation, it's helpful to suggest T::from(_)
too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment