-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Confusing error message: "can't qualify macro invocation with pub
" when a inherent method lacks "fn"
#38911
Comments
If |
On the contrary, it seems to me this has been fixed: (current playpen, presumably 1.20.0)
|
Ahah, it still occurs for functions that are not part of an impl. pub get(x: u8) {}
fn main() {}
@estebank 's analysis seems to suggest that impl methods should still have issues though. I wonder if there is another example where an impl method still produces the old error? |
Just wanted to say, this happens when you create a struct but forget the pub MyStruct { }; // keyword struct missing
fn main() { } Compiling playground v0.0.1 (file:///playground)
error: can't qualify macro invocation with `pub`
--> src/main.rs:1:1
|
1 | pub MyStruct { }; // keyword struct missing
| ^^^
|
= help: try adjusting the macro to put `pub` inside the invocation
error: expected one of `!` or `::`, found `{`
--> src/main.rs:1:14
|
1 | pub MyStruct { }; // keyword struct missing
| -^ unexpected token
| |
| expected one of `!` or `::` here
error: aborting due to 2 previous errors A better error message would be helpful. |
Account for missing keyword in fn/struct definition Fix #38911.
Both stable 1.14 and nightly 2017-01-06.
playpen
(Edit: Above example is fixed as of 1.20.0, but free functions are affected.)
while the actual issue is that the definition of
get
is missing thefn
keyword.The text was updated successfully, but these errors were encountered: