-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Better user experience when attempting to call associated functions with dot notation #22692
Comments
Current error:
Not ideal either... |
Current output:
I believe the following would be appropriate output:
|
I'd like to work on this. I think I can see where to change it. If someone wants to mentor let me know, otherwise I might ask on IRC or Discourse if I get stuck. |
@sourcefrog feel free to do so and to reach out to anyone in the team! As soon as you have some code written, make an early PR so that we can take a look at it and provide feedback on the code itself. Also, you should probably be looking at For the code |
|
You need to check that |
Better user experience when attempting to call associated functions with dot notation Closes rust-lang#22692
New users might attempt to write something like this, (e.g. if they're coming from Java):
This will not compile since they're not using
::
. This is what the compiler outputs when compiling:I find this error message pretty misleading. It'd be great if there was a lint that would check the available static methods of a struct/enum and if there's one that matches, suggest it instead (in the case above, suggest using
String::new()
).The text was updated successfully, but these errors were encountered: