Skip to content

Reword malformed attribute input diagnostics #61140

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

Merged
merged 1 commit into from
May 27, 2019

Conversation

estebank
Copy link
Contributor

  • Handle empty cfg_attr attribute
  • Reword empty derive attribute error
  • Use consistend error message: "malformed attrname attribute input"
  • Provide suggestions when possible
  • Move note/help to label/suggestion
  • Use consistent wording "ill-formed" -> "malformed"
  • Move diagnostic logic out of parser

Split up from #61026, where there's prior conversation.

@rust-highfive
Copy link
Contributor

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 24, 2019
@estebank
Copy link
Contributor Author

estebank commented May 24, 2019

CC @rust-lang/wg-diagnostics @petrochenkov @Centril

@bors

This comment has been minimized.

- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
- Use consistend error message: "malformed `attrname` attribute input"
- Provide suggestions when possible
- Move note/help to label/suggestion
- Use consistent wording "ill-formed" -> "malformed"
- Move diagnostic logic out of parser
@estebank estebank force-pushed the attr-diagnostics branch from 2e85ec1 to 609ffa1 Compare May 25, 2019 18:56
@michaelwoerister
Copy link
Member

Thanks, @estebank! Looks good to me.
@bors r+

@bors
Copy link
Collaborator

bors commented May 27, 2019

📌 Commit 609ffa1 has been approved by michaelwoerister

@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 May 27, 2019
Centril added a commit to Centril/rust that referenced this pull request May 27, 2019
…lwoerister

Reword malformed attribute input diagnostics

- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
- Use consistend error message: "malformed `attrname` attribute input"
- Provide suggestions when possible
- Move note/help to label/suggestion
- Use consistent wording "ill-formed" -> "malformed"
- Move diagnostic logic out of parser

Split up from rust-lang#61026, where there's prior conversation.
@petrochenkov petrochenkov self-assigned this May 27, 2019
@@ -1858,24 +1858,32 @@ impl<'a> PostExpansionVisitor<'a> {

match attr.parse_meta(self.context.parse_sess) {
Ok(meta) => if !should_skip(name) && !template.compatible(&meta.node) {
let error_msg = format!("malformed `{}` attribute input", name);
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, "malformed" is usually used in context of biology, like "malformed foetus/limb".
"Ill-formed" is something not fitting into a language/grammar.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤷‍♂ I've heard malformed being used wrt. syntax as well; a google search does give plenty of results for "malformed syntax". I've also used "malformed" in the context of grammar myself before.

@petrochenkov petrochenkov removed their assignment May 27, 2019
@bors
Copy link
Collaborator

bors commented May 27, 2019

⌛ Testing commit 609ffa1 with merge e70d538...

bors added a commit that referenced this pull request May 27, 2019
Reword malformed attribute input diagnostics

- Handle empty `cfg_attr` attribute
- Reword empty `derive` attribute error
- Use consistend error message: "malformed `attrname` attribute input"
- Provide suggestions when possible
- Move note/help to label/suggestion
- Use consistent wording "ill-formed" -> "malformed"
- Move diagnostic logic out of parser

Split up from #61026, where there's prior conversation.
@bors
Copy link
Collaborator

bors commented May 27, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: michaelwoerister
Pushing e70d538 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 27, 2019
@bors bors merged commit 609ffa1 into rust-lang:master May 27, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

6 participants