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

libsyntax: Explicit error message for sugared doc comments. #17218

Closed

Conversation

iliekturtles
Copy link
Contributor

Display an explicit message about items missing after sugared doc
comment attributes. References #2789.

  • I tried looking through parser.rs for an appropriate location for expected_item_err and ended up putting it just above the first use. Is there a better location?
  • Did I add enough test cases? Too many? Should I add more cases for the original error message?

@@ -3343,22 +3343,32 @@ impl<'a> Parser<'a> {
})
}

/// Get an expected item after attributes error message.
fn expected_item_err(attrs: &[Attribute]) -> &'static str {
if attrs.iter().any(|attr| attr.node.is_sugared_doc) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this should just check the last one, or possibly list all possibilities.

e.g, talking about doc comments for

/// Foo
#[inline]
#[foo]
#[bar]

is a little weird.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I will submit an update tomorrow at some point.

@iliekturtles iliekturtles force-pushed the 2789-invalid-doc-comment branch 3 times, most recently from 0a8f097 to 7005ab0 Compare September 18, 2014 00:42
Display an explicit message about items missing after sugared doc
comment attributes. References rust-lang#2789.
@iliekturtles iliekturtles force-pushed the 2789-invalid-doc-comment branch from 7005ab0 to 4a76700 Compare September 20, 2014 15:51
@iliekturtles
Copy link
Contributor Author

r? Rebased and looking to get some movement.

@huonw
Copy link
Member

huonw commented Sep 20, 2014

Thanks!

bors added a commit that referenced this pull request Sep 20, 2014
…huonw

Display an explicit message about items missing after sugared doc
comment attributes. References #2789.

 * I tried looking through `parser.rs` for an appropriate location for `expected_item_err` and ended up putting it just above the first use. Is there a better location?
 * Did I add enough test cases? Too many? Should I add more cases for the original error message?
@bors bors closed this Sep 21, 2014
@iliekturtles iliekturtles deleted the 2789-invalid-doc-comment branch September 21, 2014 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants