-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Misleading error message with malformed turbofishes #54521
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
Comments
For reference, this is how the compiler responds to the same typo elsewhere. fn main() {
println!("{:?}", Vec::<usize>>::new());
}
|
Just ran into this. Weird/confusing/unhelpful error message -- the real problem is an extra delimiter as you said. |
The opposite problem should also be handled, probably as part of a separate PR: Created #57819 to track this case. |
Centril
added a commit
to Centril/rust
that referenced
this issue
Jan 23, 2019
Add error for trailing angle brackets. Fixes rust-lang#54521. This PR adds a error (and accompanying machine applicable suggestion) for trailing angle brackets on function calls with a turbofish. r? @estebank
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I typoed the angle brackets when attempting turbofish.
(Playground)
I expected to see this happen: To get an error indicating that I had an extra closing
angle bracket after my turbofish, or that I had a mismatched delimiter.
Here is what happened instead:
Errors:
This error message refers to the case when you attempt to use turbofish on a struct field
rather than a method or function, like
struct.field::<usize>
. However, this error messageis confusing to users because, if you look at the end of the collect call, there are parentheses,
and this looks like a correctly formed method call, which obscures the real error.
The text was updated successfully, but these errors were encountered: