-
Notifications
You must be signed in to change notification settings - Fork 13.3k
missing fn
before main()
-- error could be improved
#65381
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
cc @estebank @petrochenkov -- While this would be good to fix, it is probably difficult and I suspect it requires some thought to avoid erroring on e.g. |
Note that we already do this for trait items. In those cases we already do some bounded lookahead to look for |
Fwiw, I made this typo today:
A better error message would be:
|
I don't know if it fits here, but it would be good to improve the error messages for users using Example: fun main() {}
|
For the bare C-style
|
@rustbot claim |
As a newcomer to Rust, sometimes I forget
fn
beforemain()
and the error message doesn't make sense in this instance:Example file:
Error message
suggested change:
"^ expected prior
fn
for a function declaration or suffix!
for a macro"I'm not familiar with a case where
::
would make sense here without other changes too.The text was updated successfully, but these errors were encountered: