Skip to content
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

improve error message of inner attribute syntax #49104

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

csmoe
Copy link
Member

@csmoe csmoe commented Mar 17, 2018

Fixes #49040

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 17, 2018
@csmoe csmoe force-pushed the semicolon_error branch 2 times, most recently from 537c20a to 48be02b Compare March 17, 2018 09:03
let token_str = self.this_token_to_string();
self.bump();
let msg = "unexpected semicolon";
let help_msg = format!("consider remove this semicolon: `{}`", &token_str);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"remove" -> "removing"

Also it's better to use span_label here instead of help , so the "consider remove this semicolon" message appears closer to the error. Printing ": {}" would also be unnecessary in this case.
(There are many examples of using span_label in the parser.)

Copy link
Member Author

@csmoe csmoe Mar 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank for your advice.
I found that this situation was already covered by expect item, found {} like error suggestion just now, so I removed the whole extra if {} block here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, indeed!

// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(unused_variables)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error annotation in the test itself is also required - //~ ERROR unexpected semicolon.

It also looks you have composed the .stderr file manually (stderr files don't have licenses), the script src/test/ui/update-all-references.sh can be used to generate it automatically.

CI currently fails due to these two issues.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2018
@csmoe csmoe added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 17, 2018
@petrochenkov
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 17, 2018

📌 Commit 9f5a356 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Mar 19, 2018
improve error message of inner attribute syntax

Fixes rust-lang#49040
bors added a commit that referenced this pull request Mar 20, 2018
Rollup of 17 pull requests

- Successful merges: #46518, #48810, #48834, #48902, #49004, #49092, #49096, #49099, #49104, #49125, #49139, #49152, #49157, #49161, #49166, #49176, #49184
- Failed merges:
@bors bors merged commit 9f5a356 into rust-lang:master Mar 20, 2018
@csmoe csmoe deleted the semicolon_error branch July 13, 2018 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants