-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
explain doc comments in macros a bit #98882
Conversation
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
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.
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 |
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.
"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?
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.
@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?
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 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.
c888b7c
to
1f574de
Compare
re-requesting review for last commit @rustbot ready |
1f574de
to
4a46f36
Compare
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.
r=me after rebase
4a46f36
to
d2e5a92
Compare
@bors r=davidtwco |
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
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