-
Notifications
You must be signed in to change notification settings - Fork 445
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
doc annotation on modules #2247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good! See comments.
src/compile_error.rs
Outdated
attribute.name(), | ||
) | ||
} | ||
InvalidAttribute { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arms of this match statement should be sorted by variant name.
src/parser.rs
Outdated
@@ -430,6 +410,17 @@ impl<'run, 'src> Parser<'run, 'src> { | |||
Some(Keyword::Alias) if self.next_are(&[Identifier, Identifier, ColonEquals]) => { | |||
items.push(Item::Alias(self.parse_alias(attributes)?)); | |||
} | |||
Some(Keyword::Mod) | |||
if self.next_are(&[Identifier, Identifier, Comment]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is so heinous that we should deduplicate it. Maybe Parser::next_is_module
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM! I refactored attribute parsing to just parse attributes before the item, then parse the item, and if the item didn't use the attributes, then return a new CompileErrorKind::ExtraneousAttribute error.
#2207