-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Identify missing item category in impl
s
#40815
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
Conversation
```rust struct S; impl S { pub hello_method(&self) { println!("Hello"); } } fn main() { S.hello_method(); } ``` ```rust error: can't qualify macro invocation with `pub` --> file.rs:3:4 | 3 | pub hello_method(&self) { | ^^^- - expected `!` here for a macro invocation | | | did you mean to write `fn` here for a method declaration? | = help: try adjusting the macro to put `pub` inside the invocation ```
👍 |
This seems like a step in the right direction, though the help it's giving seems confusing. Is there any way for us to detect if hello_method is a macro? It seems at a glance that these macro messages are distracting the user from the key issue. |
@jonathandturner I'll see if I can find a macro with the name and output the current output, otherwise output: error: <ERROR>
--> file.rs:3:4
|
3 | pub hello_method(&self) {
| ^ missing `fn` here for a method declaration? What do you think the error message should be for this? |
@estebank - yeah, if we can get it down to that, that'd be great. |
@jonathandturner updated output to error: missing `fn` for method declaration
--> file.rs:3:4
|
3 | pub hello_method(&self) {
| ^ missing `fn` It doesn't check if the parsed path is a macro name as I couldn't see a way to check the context in the parser, so I just look ahead to see if a |
Hmm, that sounds best as a separate PR from this one. |
Ping. |
So for me it's fine as is, so I'll r+. Thanks! @bors: r+ |
📌 Commit c963d61 has been approved by |
⌛ Testing commit c963d61 with merge c84f7d9... |
💔 Test failed - status-travis |
@bors r=GuillaumeGomez rebased to master |
📌 Commit 8f31e19 has been approved by |
⌛ Testing commit 8f31e19 with merge 854dca3... |
💔 Test failed - status-travis |
… On Mon, Apr 3, 2017 at 1:50 PM, bors ***@***.***> wrote:
💔 Test failed - status-travis
<https://travis-ci.org/rust-lang/rust/builds/218203192>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#40815 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95OIELg7HXvPK9o-o3sKOMMa6-J1iks5rsU1ygaJpZM4Mo-vF>
.
|
Identify missing item category in `impl`s ```rust struct S; impl S { pub hello_method(&self) { println!("Hello"); } } fn main() { S.hello_method(); } ``` ```rust error: missing `fn` for method declaration --> file.rs:3:4 | 3 | pub hello_method(&self) { | ^ missing `fn` ``` Fix rust-lang#40006. r? @pnkfelix CC @jonathandturner @GuillaumeGomez
Identify missing item category in `impl`s ```rust struct S; impl S { pub hello_method(&self) { println!("Hello"); } } fn main() { S.hello_method(); } ``` ```rust error: missing `fn` for method declaration --> file.rs:3:4 | 3 | pub hello_method(&self) { | ^ missing `fn` ``` Fix rust-lang#40006. r? @pnkfelix CC @jonathandturner @GuillaumeGomez
Fix #40006. r? @pnkfelix CC @jonathandturner @GuillaumeGomez