-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
rustc_ast: Stop using "string typing" for doc comment tokens #74627
Conversation
This needs a crater run, proc macros sometimes rely on very strange things. |
⌛ Trying commit e5c176725dd72cadd04f66f74cb85ad5dd811eb5 with merge 1f8642fb70240fe4e9791c141bd2f3f6bcbf1eb1... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bors try |
⌛ Trying commit 6a57098ae079d8dd9adac6c969a8092d63cf6dfc with merge 22dd2dd1dc07f63ae9394352d412f020d2985684... |
☀️ Try build successful - checks-actions, checks-azure |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚨 Experiment 🆘 Can someone from the infra team check in on this? @rust-lang/infra |
@craterbot retry seems to have been spurious |
🚨 Error: failed to parse the command 🆘 If you have any trouble with Crater please ping |
@craterbot retry |
🛠️ Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
No regressions related to this PR. |
6a57098
to
291e9d4
Compare
Updated with the requested comments. |
291e9d4
to
e93a29d
Compare
@petrochenkov: Could you add a test verifying that proc-macros receive the original doc comment value (e.g. without any whitespace trimming)? r=me once that's done. |
Explicitly store their kind and style retrieved during lexing in the token
…cros Beautify all doc strings in rustdoc instead, including those in `#[doc]` attributes
e93a29d
to
a7eabec
Compare
@bors r=Aaron1011 |
📌 Commit a7eabec has been approved by |
☀️ Test successful - checks-actions, checks-azure |
/// and returns `None` if it's a regular comment. | ||
pub fn line_doc_comment_style(line_comment: &str) -> Option<AttrStyle> { | ||
let line_comment = line_comment.as_bytes(); | ||
assert!(line_comment.starts_with(b"//")); |
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.
Is the choice is to panic instead of return None?
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.
We are not using this function on arbitrary strings, only on actual comments, so we can make it stricter.
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.
In that case I think unwrapping at call site seems to be better.
Explicitly store their kind and style retrieved during lexing in the
token::DocComment
.Also don't "beautify" doc comments before converting them to
#[doc]
attributes when passing them to macros (both declarative and procedural).The trimming of empty lines, lines containing only
*
s, etc is purely a rustdoc's job as a part of its presentation of doc strings to users, rustc must not do this and must pass tokens as precisely as possible internally.