-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
parser: show a helpful note on unexpected inner comment #33333
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
|
||
//! Misplaced comment... | ||
//~^ ERROR expected outer comment | ||
//~| inner comments like this must be placed before any items |
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.
shouldn't this say NOTE?
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.
I guess :) will fix with the new message.
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.
(btw, ping me when you need re-review, I'm not actively watching the PRs)
@wafflespeanut had attempted a more comprehensive diagnostics overhaul of the parser when it comes to unexpected comments-that-aren't, but it didn't work out so well IIRC. |
r? @Manishearth |
let mut err = self.fatal("expected outer doc comment"); | ||
err.fileline_note(self.span, "inner doc comments like this \ | ||
(starting with `//!` or `/*!`) \ | ||
must be placed before any items"); |
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.
s/must be placed before any items/can only appear before items/
@bors delegate+ with minor nit |
✌️ @birkenfeld can now approve this pull request |
@bors r=Manishearth |
📌 Commit b446c99 has been approved by |
⌛ Testing commit b446c99 with merge 9cce34c... |
💔 Test failed - auto-linux-64-cross-armhf |
@@ -35,7 +35,11 @@ impl<'a> Parser<'a> { | |||
self.span.hi | |||
); | |||
if attr.node.style != ast::AttrStyle::Outer { | |||
return Err(self.fatal("expected outer comment")); | |||
let mut err = self.fatal("expected outer doc comment"); | |||
err.fileline_note(self.span, "inner doc comments like this \ |
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.
won't work anymore
@bors r=Manishearth 72560e1 |
@bors r+ |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 72560e1 has been approved by |
⌛ Testing commit 72560e1 with merge 0d61bb3... |
parser: show a helpful note on unexpected inner comment Fixes: #30318.
Fixes: #30318.