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

explain doc comments in macros a bit #98882

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

compiler-errors
Copy link
Member

Open to suggestions on improving this... macro parsing is very foreign to me.

Should we have a structured suggestion to turn them into their regular non-doc comments?

Fixes #92846
Fixes #97850

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 4, 2022
@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 4, 2022
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

LGTM, r=me unless you want to address the comment first

| ^^^^^^^^^
| |
| no rules expected this token in macro call
| inner doc comments expand to `#![doc = "..."]`, which is what this macro attempted to match
Copy link
Member

@jyn514 jyn514 Jul 4, 2022

Choose a reason for hiding this comment

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

"which is what this macro attempted to match" seems confusing. It seems to be using "macro" to mean "the compiler's expansion of this macro". But I would normally expect it to mean "the matchers defined in the macro", which makes this confusing - if it matches, why didn't it compile?

I think just the first half (this is a doc comment) is clear enough, maybe keep only that?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jyn514, I wanted to stress that the macro sees the token stream # ! [ doc = and not /// doc comment, and that's why we get "unexpected ! token". is there a clearer way to express this?

Copy link
Member

Choose a reason for hiding this comment

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

I don't find this message confusing, so I'll approve and if we come up with something better then we change it to that in a follow up.

@Dylan-DPC Dylan-DPC 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 Jul 5, 2022
@compiler-errors compiler-errors force-pushed the explain-doc-comments-in-macros branch from c888b7c to 1f574de Compare July 8, 2022 03:22
@compiler-errors
Copy link
Member Author

re-requesting review for last commit

@rustbot ready

@rustbot rustbot 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 Jul 8, 2022
@compiler-errors compiler-errors force-pushed the explain-doc-comments-in-macros branch from 1f574de to 4a46f36 Compare July 8, 2022 03:24
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

r=me after rebase

@compiler-errors compiler-errors force-pushed the explain-doc-comments-in-macros branch from 4a46f36 to d2e5a92 Compare July 10, 2022 23:52
@compiler-errors
Copy link
Member Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Jul 10, 2022

📌 Commit d2e5a92 has been approved by davidtwco

It is now in the queue for this repository.

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 11, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#98882 (explain doc comments in macros a bit)
 - rust-lang#98907 (Deny float const params even when `adt_const_params` is enabled)
 - rust-lang#99091 (Do not mention private types from other crates as impl candidates)
 - rust-lang#99140 (Implement `SourceMap::is_span_accessible`)
 - rust-lang#99147 (Mention similarly named associated type even if it's not clearly in supertrait)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9431520 into rust-lang:master Jul 11, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 11, 2022
@compiler-errors compiler-errors deleted the explain-doc-comments-in-macros branch August 11, 2023 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
7 participants