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

rustc_ast: Stop using "string typing" for doc comment tokens #74627

Merged
merged 5 commits into from
Aug 7, 2020

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Jul 22, 2020

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.

@petrochenkov
Copy link
Contributor Author

This needs a crater run, proc macros sometimes rely on very strange things.
@bors try

@bors
Copy link
Contributor

bors commented Jul 22, 2020

⌛ Trying commit e5c176725dd72cadd04f66f74cb85ad5dd811eb5 with merge 1f8642fb70240fe4e9791c141bd2f3f6bcbf1eb1...

@petrochenkov petrochenkov added the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Jul 22, 2020
@rust-highfive

This comment has been minimized.

@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jul 22, 2020
@rust-highfive

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

@bors try

@bors
Copy link
Contributor

bors commented Jul 22, 2020

⌛ Trying commit 6a57098ae079d8dd9adac6c969a8092d63cf6dfc with merge 22dd2dd1dc07f63ae9394352d412f020d2985684...

@bors
Copy link
Contributor

bors commented Jul 22, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: 22dd2dd1dc07f63ae9394352d412f020d2985684 (22dd2dd1dc07f63ae9394352d412f020d2985684)

@petrochenkov
Copy link
Contributor Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-74627 created and queued.
🤖 Automatically detected try build 22dd2dd1dc07f63ae9394352d412f020d2985684
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 22, 2020
@craterbot
Copy link
Collaborator

🚧 Experiment pr-74627 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚨 Experiment pr-74627 has encountered an error: command Command { std: "/workspace/cargo-home/bin/rustup-toolchain-install-master" "e22b61bff0bdd08be7665607cb7be3748c8a35d2" "-c" "cargo", kill_on_drop: false } failed
🛠️ If the error is fixed use the retry command.

🆘 Can someone from the infra team check in on this? @rust-lang/infra
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Mark-Simulacrum
Copy link
Member

@craterbot retry seems to have been spurious

@craterbot
Copy link
Collaborator

🚨 Error: failed to parse the command

🆘 If you have any trouble with Crater please ping @rust-lang/infra!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@Mark-Simulacrum
Copy link
Member

@craterbot retry

@craterbot
Copy link
Collaborator

🛠️ Experiment pr-74627 queued again.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🚧 Experiment pr-74627 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-74627 is completed!
📊 4 regressed and 5 fixed (114124 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Aug 3, 2020
@petrochenkov
Copy link
Contributor Author

No regressions related to this PR.
r? @Aaron1011, I guess

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2020
@petrochenkov
Copy link
Contributor Author

Updated with the requested comments.

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 4, 2020
@Aaron1011
Copy link
Member

@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.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 5, 2020
@petrochenkov
Copy link
Contributor Author

@bors r=Aaron1011

@bors
Copy link
Contributor

bors commented Aug 6, 2020

📌 Commit a7eabec has been approved by Aaron1011

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 6, 2020
@bors
Copy link
Contributor

bors commented Aug 7, 2020

⌛ Testing commit a7eabec with merge 64f99b4...

@bors
Copy link
Contributor

bors commented Aug 7, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Aaron1011
Pushing 64f99b4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 7, 2020
@bors bors merged commit 64f99b4 into rust-lang:master Aug 7, 2020
/// 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"//"));
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

None yet

8 participants